package transfer

import (
	"data-transfer/domain"
	"data-transfer/global"
	"data-transfer/plugins"
	"data-transfer/utils"
	"encoding/json"
	"fmt"
	"github.com/go-mysql-org/go-mysql/canal"
	"github.com/shopspring/decimal"
	"go.uber.org/zap"
	"log"
	"strings"
	"time"
)

type DataChangeEventHandler struct {
	canal.DummyEventHandler
	CDB plugins.DB
	TDB plugins.DB
	//	ADB        plugins.DB
	IsFirstRun bool
}

func (h *DataChangeEventHandler) OnRow(e *canal.RowsEvent) error {
	//gocanal首次执行，加载binlog
	if h.IsFirstRun {
		//global.LOG.Info("go-canal synchronize binlog finished! ")
		return nil
	} else {
		// 资产数据主要指标更新map，涉及到表：TQ_FIN_PRGFINMAININDEX、TQ_FIN_PRGINDICDATA、TQ_FIN_PRGINDICDATASUB
		keyIndicatorUpdateMap := make(map[string]string)
		// 资产数据主要指标新增map
		//keyIndicatorInsertMap := make(map[string]interface{})
		// 资产数据主要指标删除map
		//keyIndicatorDeleteMap := make(map[string]interface{})

		//银行利润表(新准则产品表)
		if e.Table.Name == "TQ_FIN_PRGBINCSTATEMENTNEW" || e.Table.Name == "tq_fin_prgbincstatementnew" {
			//只涉及到一条业务数据并且与TQ_FIN_PRGINCSTATEMENTNEW表同步关联，可不用考虑同步逻辑
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}
				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//只新增 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					if symbols != nil {
						for _, symbol := range symbols {
							reportYear := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
							reportDateType := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
							//判断是否已经有一般企业利润数据
							has, _ := h.TDB.HasIncomeStatement(compCode, symbol.Symbol, reportYear, reportDateType)
							if has { //如果存在则进行更新
								updateMap := make(map[string]string)

								bizAdminExpen := fmt.Sprintf("%v", insertedMap["BIZADMINEXPEN"])
								if bizAdminExpen == "<nil>" {
									bizAdminExpen = ""
								}
								updateMap["BIZADMINEXPEN"] = bizAdminExpen //业务及管理费用

								//设置通用map key值
								ry := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
								updateMap["REPORTYEAR"] = ry //会计年度
								rdt := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
								updateMap["REPORTDATETYPE"] = rdt //报告期类型
								cpc := fmt.Sprintf("%v", insertedMap["COMPCODE"])
								updateMap["COMPCODE"] = cpc // 公司内码

								updateMap["SYMBOL"] = symbol.Symbol //证券编码

								affected, err1 := h.TDB.UpdateIncomeStatement4Bank(updateMap) // 更新财务利润信息
								if err1 != nil {
									//仅记录出错日志，不退出程序，
									global.LOG.Error("goCanal Insert Action 更新银行利润表(新准则产品表)出错:", zap.Any("err", err1))
								} else {
									global.LOG.Info("goCanal Insert Action 更新银行利润表(新准则产品表)成功:", zap.Int64("nums", affected))
								}

								dm := new(domain.DATA_MONITOR)
								dm.Action = INSERT_ACTION
								dm.BizDesc = "新增银行利润数据"
								dm.SourceTable = "TQ_FIN_PRGBINCSTATEMENTNEW"
								dm.TargetTable = "INCOME_STATEMENT"
								r0json, _ := json.Marshal(e.Rows[0])
								dm.SourceDataJson = string(r0json)   //新增的值
								dm.ModifiedDataJson = string(r0json) //新增后的值
								dm.ActionTime = utils.GetNowTimeStr()
								if err1 != nil {
									dm.ErrInfo = err1.Error()
								}
								rows = append(rows, dm)

							} else { //不存在则新增
								endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])

								prgincstatementNew, errb := h.CDB.GetPrgIncStatementNewByBizKey(compCode, endDate, reportYear, reportDateType)
								if errb != nil {
									global.LOG.Error("goCanal 获取一般企业利润信息失败:", zap.Any("err", errb))
								}

								defVal := "0.000000"
								if prgincstatementNew != nil {

									bizinco := prgincstatementNew.Bizinco
									if bizinco == "" || bizinco == "null" {
										bizinco = defVal
									}
									insertedMap["BIZTOTINCO"] = bizinco //营业收入

									bizcost := prgincstatementNew.Bizcost
									if bizcost == "" || bizcost == "null" {
										bizcost = defVal
									}
									insertedMap["BIZTOTCOST"] = bizcost //营业成本

									//银行三费合一
									bizAdminExpen := fmt.Sprintf("%v", insertedMap["BIZADMINEXPEN"])
									if bizAdminExpen == "<nil>" {
										bizAdminExpen = defVal
									}
									insertedMap["MANAEXPE"] = bizAdminExpen  //管理费用
									insertedMap["SALESEXPE"] = bizAdminExpen //营业费用
									insertedMap["FINEXPE"] = bizAdminExpen   //财务费用

									perProfit := prgincstatementNew.Perprofit
									if perProfit == "" || perProfit == "null" {
										perProfit = defVal
									}
									insertedMap["PERPROFIT"] = perProfit //营业利润

									inveInco := prgincstatementNew.Inveinco
									if inveInco == "" || inveInco == "null" {
										inveInco = defVal
									}
									insertedMap["INVEINCO"] = inveInco //投资收益

									totProfit := prgincstatementNew.Totprofit
									if totProfit == "" || totProfit == "null" {
										totProfit = defVal
									}
									insertedMap["TOTPROFIT"] = totProfit //利润总额

									netProfit := prgincstatementNew.Netprofit
									if netProfit == "" || netProfit == "null" {
										netProfit = defVal
									}
									insertedMap["NETPROFIT"] = netProfit //净利润

									nonoReve := prgincstatementNew.Nonoreve //营业外收入
									if nonoReve == "" || nonoReve == "null" {
										nonoReve = defVal
									}

									nonoExpe := prgincstatementNew.Nonoexpe //营业外支出
									if nonoExpe == "" || nonoExpe == "null" {
										nonoExpe = defVal
									}

									nonoreveDec, _ := decimal.NewFromString(nonoReve)
									nonoexpeDec, _ := decimal.NewFromString(nonoExpe)
									nnoiDec := nonoreveDec.Sub(nonoexpeDec)
									insertedMap["NONOREVE"] = nnoiDec //营业外收支净额

									insertedMap["SYMBOL"] = symbol.Symbol
									insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

									affected, err1 := h.TDB.InsertIncomeStatementSingle(INSERT_INCOME_STATEMENT_SQL, insertedMap)
									if err1 != nil {
										//仅记录出错日志，不退出程序，
										global.LOG.Error("新增企业利润出错:", zap.Any("err", err1))
									} else {
										global.LOG.Info("新增企业利润成功:", zap.Int64("nums", affected))
									}

									dm := new(domain.DATA_MONITOR)
									dm.Action = INSERT_ACTION
									dm.BizDesc = "新增银行企业利润数据"
									dm.SourceTable = "TQ_FIN_PRGBINCSTATEMENTNEW"
									dm.TargetTable = "INCOME_STATEMENT"
									r0json, _ := json.Marshal(e.Rows[0])
									dm.SourceDataJson = string(r0json)   //新增的值
									dm.ModifiedDataJson = string(r0json) //新增后的值
									dm.ActionTime = utils.GetNowTimeStr()
									if err1 != nil {
										dm.ErrInfo = err1.Error()
									}
									rows = append(rows, dm)

								}

							}

						}
					}

				}

				//插入操作日志
				if len(rows) > 0 {
					affDm, errL := h.TDB.InsertDataMonitor(rows)
					if errL != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", errL))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {
					updatedMap[e.Table.Columns[i].Name] = val
				}

				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal update.获取symbol失败:", zap.Any("err", err))
					return err
				}
				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//只新增 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					if symbols != nil {
						for _, symbol := range symbols {
							um := make(map[string]string)
							bizAdminExpen := fmt.Sprintf("%v", updatedMap["BIZADMINEXPEN"])
							if bizAdminExpen == "<nil>" {
								bizAdminExpen = "0.000000"
							}
							um["BIZADMINEXPEN"] = bizAdminExpen //业务及管理费用

							//设置通用map key值
							ry := fmt.Sprintf("%v", updatedMap["REPORTYEAR"])
							um["REPORTYEAR"] = ry //会计年度
							rdt := fmt.Sprintf("%v", updatedMap["REPORTDATETYPE"])
							um["REPORTDATETYPE"] = rdt //报告期类型
							cpc := fmt.Sprintf("%v", updatedMap["COMPCODE"])
							um["COMPCODE"] = cpc // 公司内码

							um["SYMBOL"] = symbol.Symbol //证券编码

							affected, err1 := h.TDB.UpdateIncomeStatement4Bank(um) // 更新财务利润信息
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal update Action 更新银行利润表(新准则产品表)出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal update Action 更新银行利润表(新准则产品表)成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = UPDATE_ACTION
							dm.BizDesc = "更新银行利润数据"
							dm.SourceTable = "TQ_FIN_PRGBINCSTATEMENTNEW"
							dm.TargetTable = "INCOME_STATEMENT"

							r1json, _ := json.Marshal(e.Rows[1])
							dm.ModifiedDataJson = string(r1json) //更改后的值

							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json) //更改前的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)
						}
					}

				}

				//插入操作日志
				if len(rows) > 0 {
					affDm, errL := h.TDB.InsertDataMonitor(rows)
					if errL != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", errL))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val
				}

				compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal delete.获取symbol失败:", zap.Any("err", err))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR
				zeroVal := "0.000000"
				updateMap := make(map[string]string)

				//只删除 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					if symbols != nil {
						for _, symbol := range symbols {
							updateMap["SYMBOL"] = symbol.Symbol
							updateMap["BIZADMINEXPEN"] = zeroVal //基本每股收益

							//设置通用map key值
							ry := fmt.Sprintf("%v", deletedMap["REPORTYEAR"])
							if ry == "<nil>" {
								ry = ""
							}
							updateMap["REPORTYEAR"] = ry //会计年度
							rdt := fmt.Sprintf("%v", deletedMap["REPORTDATETYPE"])
							if rdt == "<nil>" {
								rdt = ""
							}
							updateMap["REPORTDATETYPE"] = rdt //报告期类型
							cpc := fmt.Sprintf("%v", deletedMap["COMPCODE"])
							updateMap["COMPCODE"] = cpc         // 公司内码
							updateMap["SYMBOL"] = symbol.Symbol //证券编码

							affected, err1 := h.TDB.UpdateIncomeStatement4Bank(updateMap) // 更新财务利润信息
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal delete Action 更新银行利润表(新准则产品表)出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal delete Action 更新银行利润表(新准则产品表)成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = DELETE_ACTION
							dm.BizDesc = "删除银行利润数据"
							dm.SourceTable = "TQ_FIN_PRGBINCSTATEMENTNEW"
							dm.TargetTable = "INCOME_STATEMENT"
							dm.ModifiedDataJson = "" //删除后的值为空

							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json) //删除前的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)
						}
					}

				}

				//插入操作日志
				if len(rows) > 0 {
					affDm, err2 := h.TDB.InsertDataMonitor(rows)
					if err2 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//一般企业现金流量表(新准则产品表),设置不区分大小写，一般企业现金流量表(新准则产品表)
		if e.Table.Name == "TQ_FIN_PRGCFSTATEMENTNEW" || e.Table.Name == "tq_fin_prgcfstatementnew" {
			//新增
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))

				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				// 新增操作日志
				var rows []*domain.DATA_MONITOR

				//只新增 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							insertedMap["SYMBOL"] = symbol.Symbol
							insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

							affected, err1 := h.TDB.InsertCashFlowSingle(INSERT_CASH_FLOW_SQL, insertedMap)
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("新增企业现金流出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("新增企业现金流成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增现金流数据"
							dm.SourceTable = "TQ_FIN_PRGCFSTATEMENTNEW"
							dm.TargetTable = "CASH_FLOW"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)

							affDm, err2 := h.TDB.InsertDataMonitor(rows)
							if err2 != nil {
								global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
							}
							global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

						}
					}

				}

			}
			//修改
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				//只更新 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])

				if reportType == REPORTTYPE_1 {
					affected, err := h.TDB.UpdateCashFLow(UPDATE_CASH_FLOW_SQL, updatedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("更新企业现金流出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("新增企业现金流成功:", zap.Int64("nums", affected))
					}

					//新增操作日志
					var rows []*domain.DATA_MONITOR

					dm := new(domain.DATA_MONITOR)
					dm.Action = UPDATE_ACTION
					dm.BizDesc = "更新现金流数据"
					dm.SourceTable = "TQ_FIN_PRGCFSTATEMENTNEW"
					dm.TargetTable = "CASH_FLOW"

					r1json, _ := json.Marshal(e.Rows[1])
					dm.ModifiedDataJson = string(r1json) //更改后的值

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //更改前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

				}

			}
			//删除
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

				}

				//新增操作日志
				var rows []*domain.DATA_MONITOR

				//只删除 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					affected, err := h.TDB.DeleteCashFlow(DELETE_CASH_FLOW_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("删除企业现金流出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("删除企业现金流成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除现金流数据"
					dm.SourceTable = "TQ_FIN_PRGCFSTATEMENTNEW"
					dm.TargetTable = "CASH_FLOW"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

				}

			}
		}
		//一般企业利润表(新准则产品表)
		if e.Table.Name == "TQ_FIN_PRGINCSTATEMENTNEW" || e.Table.Name == "tq_fin_prgincstatementnew" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				//取得机构资料信息
				tqCompInfos, err := h.CDB.GetCompInfoByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal 获取机构资料表信息失败:", zap.Any("err", err))
				}

				isBank := false
				if tqCompInfos != nil && len(tqCompInfos) > 0 {
					compInfo := tqCompInfos[0]
					//如果为银行
					if compInfo.Comptype1 == TQCOMPINFO_BDFI || compInfo.Comptype1 == TQCOMPINFO_BNDFI {
						isBank = true
					}
				}

				//获取组织信息，是否为银行
				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				defVal := "0.000000"

				//只新增 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])

				if reportType == REPORTTYPE_1 {
					if symbols != nil {
						for _, symbol := range symbols {

							//设置业务及管理费用
							if isBank {
								endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
								reportYear := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
								reportDateType := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
								prgbincstatementNew, errb := h.CDB.GetTqFinPrgbincstatementnewByCompCodeAndDate(compCode, endDate, reportYear, reportDateType)
								if errb != nil {
									global.LOG.Error("goCanal 获取银行利润表信息失败:", zap.Any("err", errb))
								}
								if prgbincstatementNew != nil {
									bizadminexpen := prgbincstatementNew.Bizadminexpen //业务及管理费用
									//银行的管理费用、营业费用、财务费用均维护在TQ_FIN_PRGBINCSTATEMENTNEW的BIZADMINEXPEN字段
									insertedMap["SALESEXPE"] = bizadminexpen
									insertedMap["MANAEXPE"] = bizadminexpen
									insertedMap["FINEXPE"] = bizadminexpen
								}
							}
							//设置symbol
							insertedMap["SYMBOL"] = symbol.Symbol
							insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

							//设置营业外收支净额
							nonoreve := fmt.Sprintf("%v", insertedMap["NONOREVE"])
							if nonoreve == "<nil>" {
								nonoreve = defVal
							}

							nonoexpe := fmt.Sprintf("%v", insertedMap["NONOEXPE"])
							if nonoexpe == "<nil>" {
								nonoexpe = defVal
							}

							nonoreveDec, _ := decimal.NewFromString(nonoreve)
							nonoexpeDec, _ := decimal.NewFromString(nonoexpe)
							nnoiDec := nonoreveDec.Sub(nonoexpeDec)
							insertedMap["NONOREVE"] = nnoiDec

							//营业收入设置
							bizinco := fmt.Sprintf("%v", insertedMap["BIZINCO"])
							if bizinco == "<nil>" {
								bizinco = defVal
							}
							insertedMap["BIZTOTINCO"] = bizinco

							//营业成本设置
							bizcost := fmt.Sprintf("%v", insertedMap["BIZCOST"])
							if bizcost == "<nil>" {
								bizcost = defVal
							}
							insertedMap["BIZTOTCOST"] = bizcost

							affected, err1 := h.TDB.InsertIncomeStatementSingle(INSERT_INCOME_STATEMENT_SQL, insertedMap)
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("新增企业利润出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("新增企业利润成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增一般企业利润数据"
							dm.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
							dm.TargetTable = "INCOME_STATEMENT"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)

						}
					}

				}

				if symbols != nil {

					//公司主要业务
					//根据会计日期和compCode查询公司主要业务
					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						// 是否是相应会会计年度下，最大报告期的数据（1 一季报、2 中报（累计）、3 三季报（累计）、4 年报(累计)）
						reportDateType := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
						//其他数据已通过初始化完成，只追加合并期末的年报数据，此数据只有一份
						if REPORTTYPE_1 == reportType && REPORT_DATE_TYPE_4 == reportDateType {

							reportYear := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
							busiInfos, err1 := h.CDB.GetTqSkBusiInfoByCompCodeAndReportYear(compCode, reportYear)
							if err1 != nil {
								global.LOG.Error("获取公司经营状态失败:", zap.String("compCode", compCode), zap.String("reportYear", reportYear), zap.Any("err", err1))
							}

							//取最新报表日期的数据
							maxPublishDate := ""
							if busiInfos != nil && len(busiInfos) > 0 {
								info := busiInfos[0]
								for _, o := range busiInfos {
									if strings.Compare(o.Publishdate, info.Publishdate) == 1 {
										info = o
									}
								}
								maxPublishDate = info.Publishdate
							}

							//查询出最新报表日期PublishDate的数据
							var results []*domain.TQ_SK_BUSIINFO
							for _, info := range busiInfos {
								if info.Publishdate == maxPublishDate {
									results = append(results, info)
								}
							}

							var bcis []*domain.BUSI_CLASS_INFO
							for _, b := range results { //遍历最新报表日期的数据
								r := new(domain.BUSI_CLASS_INFO)

								r.CLASSNAME = b.Classname           //分类值
								r.TCOREBIZINCOME = b.Tcorebizincome //本期主营业务收入
								r.COREBIZINCRTO = b.Corebizincrto   //占主营业务收入比例

								bcis = append(bcis, r)

							}

							productInfo, err2 := json.Marshal(bcis)
							if err2 != nil {
								global.LOG.Error("goCanal TQ_FIN_PRGINCSTATEMENTNEW.json.Marshal公司经营状况失败:", zap.Any("err", err2))
							}

							insertedMap["PRODUCTINFO"] = productInfo //产品业务口径JSON字符串
							//PUBLISHDATE 要取值于TQ_SK_BUSIINFO
							insertedMap["PUBLISHDATE"] = maxPublishDate
							insertedMap["TYPESTYLE"] = TYPE_STYLE_PRODUCT

							affectedMc, err3 := h.TDB.InsertMainCompositionSingle(INSERT_MAIN_COMPOSITION_SQL, insertedMap)
							if err3 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal.TQ_FIN_PRGINCSTATEMENTNEW 新增公司主要业务出错:", zap.Any("err", err3))
							} else {
								global.LOG.Info("goCanal.TQ_FIN_PRGINCSTATEMENTNEW 新增公司主要业务成功:", zap.Int64("nums", affectedMc))
							}

							//记录操作日志
							dm1 := new(domain.DATA_MONITOR)
							dm1.Action = INSERT_ACTION
							dm1.BizDesc = "新增公司主要业务数据"
							dm1.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
							dm1.TargetTable = "MAIN_COMPOSITION"
							r0json1, _ := json.Marshal(e.Rows[0])
							dm1.SourceDataJson = string(r0json1)   //新增的值
							dm1.ModifiedDataJson = string(r0json1) //新增后的值
							dm1.ActionTime = utils.GetNowTimeStr()
							if err3 != nil {
								dm1.ErrInfo = err3.Error()
							}
							rows = append(rows, dm1)
						}

					}

					//最新指标
					for _, symbol := range symbols {

						im := make(map[string]string)

						im["SYMBOL"] = symbol.Symbol
						im["COMPCODE"] = compCode
						im["EXCHANGE"] = TransferExchane(symbol.Exchange)

						reportYear := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])

						bizInco := fmt.Sprintf("%v", insertedMap["BIZINCO"])
						if bizInco == "<nil>" {
							bizInco = "0.000000"
						}

						im["BIZINCO"] = bizInco

						netProfit := fmt.Sprintf("%v", insertedMap["NETPROFIT"])
						if netProfit == "<nil>" {
							netProfit = "0.000000"
						}
						im["NETPROFIT"] = netProfit

						// 查询 TQ_SK_FUNDAMENTALS 股票基本面简表信息
						endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
						if endDate == "<nil>" {
							endDate = ""
						}
						dundamentals, err2 := h.CDB.GetTqSkFundamentalsBySymbolAndEndDate(symbol.Symbol, endDate)
						if err2 != nil {
							global.LOG.Error("goCanal 新增最新指标表,获取 TQ_SK_FUNDAMENTALS股票基本面简表信息出错:", zap.Any("err", err2))
						}

						if dundamentals != nil && len(dundamentals) > 0 {
							d := dundamentals[0]

							basiceps := d.Basiceps
							if basiceps == "" {
								basiceps = "0.0000"
							}
							im["BASICEPS"] = basiceps

							naps := d.Naps
							if naps == "" {
								naps = "0.0000"
							}
							im["NAPS"] = naps

							totalshare := d.Totalshare
							if totalshare == "" {
								totalshare = "0.0000"
							}
							im["TOTALSHARE"] = totalshare

							roe := d.Roe
							if roe == "" {
								roe = "0.00"
							}
							im["ROE"] = roe

							opercfps := d.Opercfps
							if opercfps == "" {
								opercfps = "0.00"
							}
							im["OPERCFPS"] = opercfps

							npgrt := d.Npgrt
							if npgrt == "" {
								npgrt = "0.00"
							}
							im["NPGRT"] = npgrt

						}

						//查询TQ_FIN_PRGFINMAININDEX 主要财务指标(产品表）信息
						prgFinMaindexs, err3 := h.CDB.GetPrgFinMainIndexByCompCodeAndEndDate(compCode, endDate)
						if err3 != nil {
							global.LOG.Error("goCanal 新增最新指标表,获取Q_FIN_PRGFINMAININDEX 主要财务指标(产品表）信息出错:", zap.Any("err", err3))
						}
						if prgFinMaindexs != nil && len(prgFinMaindexs) > 0 {
							p := prgFinMaindexs[0]
							reportDateType := p.Reportdatetype
							epsbasicepscut := p.Epsbasicepscut
							if epsbasicepscut == "" {
								epsbasicepscut = "0.000000"
							}
							im["REPORTYEAR"] = reportYear
							im["REPORTDATETYPE"] = reportDateType
							im["EPSBASICEPSCUT"] = epsbasicepscut
						}

						//查询TQ_FIN_PRGINDICDATA 衍生财务指标(产品表)_V3表信息
						indicDatas, err4 := h.CDB.GetPrgIndicDataByCompCodeAndEndDate(compCode, endDate)
						if err4 != nil {
							global.LOG.Error("goCanal 新增最新指标表,查询TQ_FIN_PRGINDICDATA 衍生财务指标(产品表)_V3表 信息出错:", zap.Any("err", err4))
						}
						if indicDatas != nil && len(indicDatas) > 0 {
							i := indicDatas[0]

							sgpmargin := i.Sgpmargin
							if sgpmargin == "" {
								sgpmargin = "0.000000"
							}
							npcut := i.Npcut
							if npcut == "" {
								npcut = "0.000000"
							}
							im["SGPMARGIN"] = sgpmargin
							im["NPCUT"] = npcut

						}

						//查询 TQ_FIN_PRGINDICDATASUB 衍生财务指标副表(产品表)_V3表信息
						indicDataSubs, err5 := h.CDB.GetPrgIndicDataSubByCompCodeAndEndDate(compCode, endDate)
						if err5 != nil {
							global.LOG.Error("goCanal 新增最新指标表,查询TQ_FIN_PRGINDICDATASUB 衍生财务指标副表(产品表)_V3表信息 信息出错:", zap.Any("err", err5))
						}

						if indicDataSubs != nil && len(indicDataSubs) > 0 {
							sub := indicDataSubs[0]
							operinyoyb := sub.Operinyoyb
							if operinyoyb == "" {
								operinyoyb = "0.000000"
							}
							netinpnrplyoyb := sub.Netinpnrplyoyb
							if netinpnrplyoyb == "" {
								netinpnrplyoyb = "0.000000"
							}
							im["OPERINYOYB"] = operinyoyb
							im["NETINPNRPLYOYB"] = netinpnrplyoyb
						}

						//最新指标
						affectedLi, err1 := h.TDB.InsertLatestIndicatorSingle(INSERT_LATEST_INDICATOR_SQL, im) // 更新主要指标
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增最新指标表出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 新增最新指标表）成功:", zap.Int64("nums", affectedLi))
						}

						//记录操作日志
						dm2 := new(domain.DATA_MONITOR)
						dm2.Action = INSERT_ACTION
						dm2.BizDesc = "新增最新指标数据"
						dm2.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
						dm2.TargetTable = "LATEST_INDICATOR"
						r0json2, _ := json.Marshal(e.Rows[0])
						dm2.SourceDataJson = string(r0json2)   //新增的值
						dm2.ModifiedDataJson = string(r0json2) //新增后的值
						dm2.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm2.ErrInfo = err1.Error()
						}
						rows = append(rows, dm2)
					}
				}

				//插入操作日志
				if len(rows) > 0 {
					affDm, errL := h.TDB.InsertDataMonitor(rows)
					if errL != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", errL))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				//取得机构资料信息
				tqCompInfos, err := h.CDB.GetCompInfoByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal 获取机构资料表信息失败:", zap.Any("err", err))
				}

				isBank := false
				if tqCompInfos != nil && len(tqCompInfos) > 0 {
					compInfo := tqCompInfos[0]
					//如果为银行
					if compInfo.Comptype1 == TQCOMPINFO_BDFI || compInfo.Comptype1 == TQCOMPINFO_BNDFI {
						isBank = true
					}
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				defVal := "0.000000"

				//只更新 REPORTTYPE 为 "1" updatedMap
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {

					//设置营业外收支净额
					nonoreve := fmt.Sprintf("%v", updatedMap["NONOREVE"])
					if nonoreve == "<nil>" {
						nonoreve = defVal
					}

					nonoexpe := fmt.Sprintf("%v", updatedMap["NONOEXPE"])
					if nonoexpe == "<nil>" {
						nonoexpe = defVal
					}

					nonoreveDec, _ := decimal.NewFromString(nonoreve)
					nonoexpeDec, _ := decimal.NewFromString(nonoexpe)
					nnoiDec := nonoreveDec.Sub(nonoexpeDec)
					updatedMap["NONOREVE"] = nnoiDec

					//营业收入设置
					bizinco := fmt.Sprintf("%v", updatedMap["BIZINCO"])
					if bizinco == "<nil>" {
						bizinco = defVal
					}
					updatedMap["BIZTOTINCO"] = bizinco

					//营业成本设置
					bizcost := fmt.Sprintf("%v", updatedMap["BIZCOST"])
					if bizcost == "<nil>" {
						bizcost = defVal
					}
					updatedMap["BIZTOTCOST"] = bizcost

					//设置业务及管理费用
					if isBank {
						endDate := fmt.Sprintf("%v", updatedMap["ENDDATE"])
						reportYear := fmt.Sprintf("%v", updatedMap["REPORTYEAR"])
						reportDateType := fmt.Sprintf("%v", updatedMap["REPORTDATETYPE"])
						prgbincstatementNew, errb := h.CDB.GetTqFinPrgbincstatementnewByCompCodeAndDate(compCode, endDate, reportYear, reportDateType)
						if errb != nil {
							global.LOG.Error("goCanal 获取银行利润表信息失败:", zap.Any("err", errb))
						}
						if prgbincstatementNew != nil {
							bizadminexpen := prgbincstatementNew.Bizadminexpen //业务及管理费用
							//银行的管理费用、营业费用、财务费用均维护在TQ_FIN_PRGBINCSTATEMENTNEW的BIZADMINEXPEN字段
							updatedMap["SALESEXPE"] = bizadminexpen
							updatedMap["MANAEXPE"] = bizadminexpen
							updatedMap["FINEXPE"] = bizadminexpen
						}
					}

					affected, erru := h.TDB.UpdateIncomeStatement(UPDATE_INCOME_STATEMENT_SQL, updatedMap)
					if erru != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 更新企业利润出错:", zap.Any("err", erru))
					} else {
						global.LOG.Info("goCanal 更新企业利润成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = UPDATE_ACTION
					dm.BizDesc = "更新一般企业利润数据"
					dm.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
					dm.TargetTable = "INCOME_STATEMENT"

					r1json, _ := json.Marshal(e.Rows[1])
					dm.ModifiedDataJson = string(r1json) //更改后的值

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //更改前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)
				}

				//公司主要业务
				//compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
				}
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						updatedMap["SYMBOL"] = symbol.Symbol
						// 是否是相应会会计年度下，最大报告期的数据（1 一季报、2 中报（累计）、3 三季报（累计）、4 年报(累计)）
						reportDateType := fmt.Sprintf("%v", updatedMap["REPORTDATETYPE"])

						//只追加合并期末的年报数据，此数据只有一份
						if REPORTTYPE_1 == reportType && REPORT_DATE_TYPE_4 == reportDateType {

							//根据会计日期和compCode查询公司主要业务
							reportYear := fmt.Sprintf("%v", updatedMap["REPORTYEAR"])
							busiInfos, err1 := h.CDB.GetTqSkBusiInfoByCompCodeAndReportYear(compCode, reportYear)
							if err1 != nil {
								global.LOG.Error("获取公司经营状态失败:", zap.String("compCode", compCode), zap.String("reportYear", reportYear), zap.Any("err", err1))
							}

							//取最新报表日期的数据
							maxPublishDate := ""
							if len(busiInfos) > 0 {
								info := busiInfos[0]
								for _, o := range busiInfos {
									if strings.Compare(o.Publishdate, info.Publishdate) == 1 {
										info = o
									}
								}
								maxPublishDate = info.Publishdate
							}

							//查询出最新报表日期PublishDate的数据
							var results []*domain.TQ_SK_BUSIINFO
							for _, info := range busiInfos {
								if info.Publishdate == maxPublishDate {
									results = append(results, info)
								}
							}

							var bcis []*domain.BUSI_CLASS_INFO
							for _, b := range results { //具有产品分类数据才会更新
								r := new(domain.BUSI_CLASS_INFO)

								r.CLASSNAME = b.Classname           //分类值
								r.TCOREBIZINCOME = b.Tcorebizincome //本期主营业务收入
								r.COREBIZINCRTO = b.Corebizincrto   //占主营业务收入比例

								bcis = append(bcis, r)
							}

							productInfo, err2 := json.Marshal(bcis)
							if err2 != nil {
								global.LOG.Error("goCanal TQ_FIN_PRGINCSTATEMENTNEW.json.Marshal公司经营状况失败:", zap.Any("err", err2))
							}

							updatedMap["PRODUCTINFO"] = string(productInfo) //产品业务口径JSON字符串

							//取EndDate为报表日期
							//endDate := fmt.Sprintf("%v", updatedMap["ENDDATE"])
							//updatedMap["PUBLISHDATE"] = endDate

							//PUBLISHDATE 要取值于TQ_SK_BUSIINFO
							updatedMap["PUBLISHDATE"] = maxPublishDate
							//产品分类口径
							updatedMap["TYPESTYLE"] = TYPE_STYLE_PRODUCT

							affectedMc, err3 := h.TDB.UpdateMainComposition(UPDATE_MAIN_COMPOSITION_SQL, updatedMap)
							if err3 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal.TQ_FIN_PRGINCSTATEMENTNEW 更新公司主要业务出错:", zap.Any("err", err3))
							} else {
								global.LOG.Info("goCanal.TQ_FIN_PRGINCSTATEMENTNEW 更改公司主要业务成功:", zap.Int64("nums", affectedMc))
							}

							//记录操作日志
							dm1 := new(domain.DATA_MONITOR)
							dm1.Action = UPDATE_ACTION
							dm1.BizDesc = "更新公司主要业务数据"
							dm1.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
							dm1.TargetTable = "MAIN_COMPOSITION"

							r1json1, _ := json.Marshal(e.Rows[1])
							dm1.ModifiedDataJson = string(r1json1) //更改后的值

							r0json1, _ := json.Marshal(e.Rows[0])
							dm1.SourceDataJson = string(r0json1) //更改前的值
							dm1.ActionTime = utils.GetNowTimeStr()
							if err3 != nil {
								dm1.ErrInfo = err3.Error()
							}
							rows = append(rows, dm1)

						}

						//最新指标
						up := make(map[string]string)
						up["SYMBOL"] = symbol.Symbol
						up["COMPCODE"] = compCode
						bizInco := fmt.Sprintf("%v", updatedMap["BIZINCO"])
						if bizInco == "<nil>" {
							bizInco = defVal
						}
						up["BIZINCO"] = bizInco
						netprofit := fmt.Sprintf("%v", updatedMap["NETPROFIT"])
						if netprofit == "<nil>" {
							netprofit = defVal
						}
						up["NETPROFIT"] = netprofit
						//最新指标
						affectedLi, err4 := h.TDB.UpdateLatestIndicator(up) // 更新主要指标
						if err4 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更改最新指标表出错:", zap.Any("err", err4))
						} else {
							global.LOG.Info("goCanal 更改最新指标表）成功:", zap.Int64("nums", affectedLi))
						}

						//记录操作日志
						dm2 := new(domain.DATA_MONITOR)
						dm2.Action = UPDATE_ACTION
						dm2.BizDesc = "更新最新指标数据"
						dm2.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
						dm2.TargetTable = "LATEST_INDICATOR"

						r1json2, _ := json.Marshal(e.Rows[1])
						dm2.ModifiedDataJson = string(r1json2) //更改后的值

						r0json2, _ := json.Marshal(e.Rows[0])
						dm2.SourceDataJson = string(r0json2) //更改前的值
						dm2.ActionTime = utils.GetNowTimeStr()
						if err4 != nil {
							dm2.ErrInfo = err4.Error()
						}
						rows = append(rows, dm2)

						//插入操作日志
						if len(rows) > 0 {
							affDm, err5 := h.TDB.InsertDataMonitor(rows)
							if err5 != nil {
								global.LOG.Error("插入日志记录出错:", zap.Any("err", err5))
							}
							global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
						}

					}
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				//只删除 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					affected, err := h.TDB.DeleteIncomeStatement(DELETE_INCOME_STATEMENT_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 删除企业利润出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 删除企业利润成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除一般企业利润数据"
					dm.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
					dm.TargetTable = "INCOME_STATEMENT"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)
				}

				//公司主要业务
				compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal delete.获取symbol失败:", zap.Any("err", err))
				}
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						deletedMap["SYMBOL"] = symbol.Symbol
						deletedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						// 是否是相应会会计年度下，最大报告期的数据（1 一季报、2 中报（累计）、3 三季报（累计）、4 年报(累计)）
						reportDateType := fmt.Sprintf("%v", deletedMap["REPORTDATETYPE"])
						//只追加合并期末的年报数据，此数据只有一份
						if REPORTTYPE_1 == reportType && REPORT_DATE_TYPE_4 == reportDateType {
							//根据会计日期和compCode查询公司主要业务
							reportYear := fmt.Sprintf("%v", deletedMap["REPORTYEAR"])
							busiInfos, err1 := h.CDB.GetTqSkBusiInfoByCompCodeAndReportYear(compCode, reportYear)
							if err1 != nil {
								global.LOG.Error("获取公司经营状态失败:", zap.String("compCode", compCode), zap.String("reportYear", reportYear), zap.Any("err", err1))
							}
							//取最新报表日期的数据
							maxPublishDate := ""
							if len(busiInfos) > 0 {
								info := busiInfos[0]
								for _, o := range busiInfos {
									if strings.Compare(o.Publishdate, info.Publishdate) == 1 {
										info = o
									}
								}
								maxPublishDate = info.Publishdate
							}
							//查询出最新报表日期PublishDate的数据
							var results []*domain.TQ_SK_BUSIINFO
							for _, info := range busiInfos {
								if info.Publishdate == maxPublishDate {
									results = append(results, info)
								}
							}

							var bcis []*domain.BUSI_CLASS_INFO
							for _, b := range results {
								r := new(domain.BUSI_CLASS_INFO)

								r.CLASSNAME = b.Classname           //分类值
								r.TCOREBIZINCOME = b.Tcorebizincome //本期主营业务收入
								r.COREBIZINCRTO = b.Corebizincrto   //占主营业务收入比例

								bcis = append(bcis, r)

							}

							productInfo, err2 := json.Marshal(bcis)
							if err2 != nil {
								global.LOG.Error("goCanal TQ_FIN_PRGINCSTATEMENTNEW.json.Marshal公司经营状况失败:", zap.Any("err", err2))
							}

							deletedMap["PRODUCTINFO"] = string(productInfo) //产品业务口径JSON字符串

							//取EndDate为报表日期
							//endDate := fmt.Sprintf("%v", deletedMap["ENDDATE"])
							//deletedMap["PUBLISHDATE"] = endDate
							//PUBLISHDATE 要取值于TQ_SK_BUSIINFO
							deletedMap["PUBLISHDATE"] = maxPublishDate
							//产品分类口径
							deletedMap["TYPESTYLE"] = TYPE_STYLE_PRODUCT
							//更新数值为0
							deletedMap["BIZTOTCOST"] = "0.000000"
							deletedMap["PERPROFIT"] = "0.000000"

							affectedMc, err2 := h.TDB.UpdateMainComposition(UPDATE_MAIN_COMPOSITION_SQL, deletedMap)
							if err2 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal.TQ_FIN_PRGINCSTATEMENTNEW 删除公司主要业务出错:", zap.Any("err", err2))
							} else {
								global.LOG.Info("goCanal.TQ_FIN_PRGINCSTATEMENTNEW 删除公司主要业务成功:", zap.Int64("nums", affectedMc))
							}

							//记录操作日志
							dm1 := new(domain.DATA_MONITOR)
							dm1.Action = DELETE_ACTION
							dm1.BizDesc = "删除公司主要业务数据"
							dm1.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
							dm1.TargetTable = "MAIN_COMPOSITION"
							dm1.ModifiedDataJson = "" //删除后的值为空

							r0json1, _ := json.Marshal(e.Rows[0])
							dm1.SourceDataJson = string(r0json1) //删除前的值
							dm1.ActionTime = utils.GetNowTimeStr()
							if err != nil {
								dm1.ErrInfo = err.Error()
							}
							rows = append(rows, dm1)

						}

						//最新指标
						affectedli, err3 := h.TDB.DeleteLatestIndicator(DELETE_LATEST_INDICATOR_SQL, deletedMap) // 更新主要指标
						if err3 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 删除最新指标表出错:", zap.Any("err", err3))
						} else {
							global.LOG.Info("goCanal 删除最新指标表）成功:", zap.Int64("nums", affectedli))
						}

						//记录操作日志
						dm2 := new(domain.DATA_MONITOR)
						dm2.Action = DELETE_ACTION
						dm2.BizDesc = "删除最新指标数据"
						dm2.SourceTable = "TQ_FIN_PRGINCSTATEMENTNEW"
						dm2.TargetTable = "LATEST_INDICATOR"
						dm2.ModifiedDataJson = "" //删除后的值为空

						r0json2, _ := json.Marshal(e.Rows[0])
						dm2.SourceDataJson = string(r0json2) //删除前的值
						dm2.ActionTime = utils.GetNowTimeStr()
						if err3 != nil {
							dm2.ErrInfo = err3.Error()
						}
						rows = append(rows, dm2)

					}
				}

				if len(rows) > 0 {
					//插入操作日志
					affDm, errl := h.TDB.InsertDataMonitor(rows)
					if errl != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", errl))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//企业资产负债表
		if e.Table.Name == "TQ_FIN_PRGBALSHEETNEW" || e.Table.Name == "tq_fin_prgbalsheetnew" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						//只新增 REPORTTYPE 为 "1" 合并期末的
						reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
						if reportType == REPORTTYPE_1 {
							affected, err1 := h.TDB.InsertBalanceSheetSingle(INSERT_BALANCE_SHEET_SQL, insertedMap)
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增企业资产负债出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 新增企业资产负债成功:", zap.Int64("nums", affected))
							}

							// 记录操作日志
							var rows []*domain.DATA_MONITOR

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增一般资产负债数据"
							dm.SourceTable = "TQ_FIN_PRGBALSHEETNEW"
							dm.TargetTable = "BALANCE_SHEET"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)

							affDm, err2 := h.TDB.InsertDataMonitor(rows)
							if err2 != nil {
								global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
							}
							global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

						}

					}
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				//只更新 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					affected, err := h.TDB.UpdateBalanceSheet(UPDATE_BALANCE_SHEET_SQL, updatedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 更新企业资产负债出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 更新企业资产负债成功:", zap.Int64("nums", affected))
					}

					// 记录操作日志
					var rows []*domain.DATA_MONITOR

					dm := new(domain.DATA_MONITOR)
					dm.Action = UPDATE_ACTION
					dm.BizDesc = "更新一般资产负债数据"
					dm.SourceTable = "TQ_FIN_PRGBALSHEETNEW"
					dm.TargetTable = "BALANCE_SHEET"

					r1json, _ := json.Marshal(e.Rows[1])
					dm.ModifiedDataJson = string(r1json) //更改后的值

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //更改前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				//只删除 REPORTTYPE 为 "1" 合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					affected, err := h.TDB.DeleteBalanceSheet(DELETE_BALANCE_SHEET_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 删除企业资产负债出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 删除企业资产负债成功:", zap.Int64("nums", affected))
					}

					//记录操作日志
					var rows []*domain.DATA_MONITOR

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除一般资产负债数据"
					dm.SourceTable = "TQ_FIN_PRGBALSHEETNEW"
					dm.TargetTable = "BALANCE_SHEET"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//资产数据主要指标相关
		if e.Table.Name == "TQ_FIN_PRGFINMAININDEX" || e.Table.Name == "tq_fin_prgfinmainindex" { //主要财务指标(产品表）
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 只更新 合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					// 记录操作日志
					var rows []*domain.DATA_MONITOR

					compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal update.获取symbol失败:", zap.Any("err", err))
					}

					for _, symbol := range symbols {
						keyIndicatorUpdateMap["SYMBOL"] = symbol.Symbol
						epsbasic := fmt.Sprintf("%v", updatedMap["EPSBASIC"])
						if epsbasic == "<nil>" {
							epsbasic = "0.000000"
						}
						keyIndicatorUpdateMap["EPSBASIC"] = epsbasic //基本每股收益

						/* //以下数据要取自表TQ_FIN_PRGINDICDATA
						naps := fmt.Sprintf("%v", updatedMap["NAPS"])
						if naps == "<nil>" {
							naps = ""
						}

						keyIndicatorUpdateMap["NAPS"] = naps //每股净资产


						opncfps := fmt.Sprintf("%v", updatedMap["OPNCFPS"])
						if opncfps == "<nil>" {
							opncfps = ""
						}
						keyIndicatorUpdateMap["OPNCFPS"] = opncfps //每股经营活动产生的现金流量净额

						roeweighted := fmt.Sprintf("%v", updatedMap["ROEWEIGHTED"])
						if roeweighted == "<nil>" {
							roeweighted = ""
						}
						keyIndicatorUpdateMap["ROEWEIGHTED"] = roeweighted //净资产收益率_加权


						roediluted := fmt.Sprintf("%v", updatedMap["ROEDILUTED"])
						if roediluted == "<nil>" {
							roediluted = ""
						}
						keyIndicatorUpdateMap["ROEDILUTED"] = roediluted //净资产收益率_摊薄

						*/
						//设置通用map key值
						reportype := fmt.Sprintf("%v", updatedMap["REPORTYEAR"])
						keyIndicatorUpdateMap["REPORTYEAR"] = reportype //会计年度
						reportDateType := fmt.Sprintf("%v", updatedMap["REPORTDATETYPE"])
						keyIndicatorUpdateMap["REPORTDATETYPE"] = reportDateType //报告期类型
						compcode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
						keyIndicatorUpdateMap["COMPCODE"] = compcode // 公司内码

						affected, err1 := h.TDB.UpdateKeyIndicator(keyIndicatorUpdateMap) // 更新主要指标
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更改主要财务指标(产品表）出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 更改主要财务指标(产品表）成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = UPDATE_ACTION
						dm.BizDesc = "更新财务主要指标数据"
						dm.SourceTable = "TQ_FIN_PRGFINMAININDEX"
						dm.TargetTable = "KEY_INDICATOR"

						r1json, _ := json.Marshal(e.Rows[1])
						dm.ModifiedDataJson = string(r1json) //更改后的值

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //更改前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

					}

					//最新指标
					um := make(map[string]string)
					//compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
					//symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					//if err != nil {
					//	global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					//}

					for _, symbol := range symbols {
						//设置symbol
						um["SYMBOL"] = symbol.Symbol
						um["COMPCODE"] = compCode

						ry := fmt.Sprintf("%v", updatedMap["REPORTYEAR"])
						um["REPORTYEAR"] = ry
						rdt := fmt.Sprintf("%v", updatedMap["REPORTDATETYPE"])
						um["REPORTDATETYPE"] = rdt
						epsBasicEpscut := fmt.Sprintf("%v", updatedMap["EPSBASICEPSCUT"])
						if epsBasicEpscut == "<nil>" {
							epsBasicEpscut = "0.000000"
						}
						um["EPSBASICEPSCUT"] = epsBasicEpscut

						affectedLi, err1 := h.TDB.UpdateLatestIndicator(um) // 更新主要指标
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更改最新指标表出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 更改最新指标表 成功:", zap.Int64("nums", affectedLi))
						}

						//记录操作日志
						dm2 := new(domain.DATA_MONITOR)
						dm2.Action = UPDATE_ACTION
						dm2.BizDesc = "更新最新指标数据"
						dm2.SourceTable = "TQ_FIN_PRGFINMAININDEX"
						dm2.TargetTable = "LATEST_INDICATOR"

						r1json2, _ := json.Marshal(e.Rows[1])
						dm2.ModifiedDataJson = string(r1json2) //更改后的值

						r0json2, _ := json.Marshal(e.Rows[0])
						dm2.SourceDataJson = string(r0json2) //更改前的值
						dm2.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm2.ErrInfo = err1.Error()
						}
						rows = append(rows, dm2)

					}

					if len(rows) > 0 {
						//插入操作日志
						affDm, err1 := h.TDB.InsertDataMonitor(rows)
						if err1 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err1))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}

				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				// 只新增 合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					}

					// 记录操作日志
					var rows []*domain.DATA_MONITOR

					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)
						exchange := TransferExchane(symbol.Exchange)
						reportYear := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
						reportDateType := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
						has, _ := h.TDB.HasKeyIndicator(compCode, symbol.Symbol, reportYear, reportDateType) //由于TQ_FIN_PRGINDICDATA表和TQ_FIN_PRGINDICDATASUB表也可能事先插入数据了，所以进行判断
						if has {                                                                             //如果存在则更新
							updateMap := make(map[string]string)

							updateMap["EXCHANGE"] = exchange

							epsbasic := fmt.Sprintf("%v", insertedMap["EPSBASIC"])
							if epsbasic == "<nil>" {
								epsbasic = "0.000000"
							}
							updateMap["EPSBASIC"] = epsbasic //基本每股收益

							/*
								naps := fmt.Sprintf("%v", insertedMap["NAPS"])
								if naps == "<nil>" {
									naps = ""
								}
								updateMap["NAPS"] = naps //每股净资产
								opncfps := fmt.Sprintf("%v", insertedMap["OPNCFPS"])
								if opncfps == "<nil>" {
									opncfps = ""
								}
								updateMap["OPNCFPS"] = opncfps //每股经营活动产生的现金流量净额
								roeweighted := fmt.Sprintf("%v", insertedMap["ROEWEIGHTED"])
								if roeweighted == "<nil>" {
									roeweighted = ""
								}
								updateMap["ROEWEIGHTED"] = roeweighted //净资产收益率_加权
								roediluted := fmt.Sprintf("%v", insertedMap["ROEDILUTED"])
								if roediluted == "<nil>" {
									roediluted = ""
								}
								updateMap["ROEDILUTED"] = roediluted //净资产收益率_摊薄

							*/
							//设置通用map key值
							ry := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
							updateMap["REPORTYEAR"] = ry //会计年度
							rdt := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
							updateMap["REPORTDATETYPE"] = rdt //报告期类型
							cpc := fmt.Sprintf("%v", insertedMap["COMPCODE"])
							updateMap["COMPCODE"] = cpc // 公司内码

							updateMap["SYMBOL"] = symbol.Symbol //证券编码

							affected, err1 := h.TDB.UpdateKeyIndicator(updateMap) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal Insert Action 更改主要财务指标(产品表）出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal Insert Action 更改主要财务指标(产品表）成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增财务主要指标数据"
							dm.SourceTable = "TQ_FIN_PRGFINMAININDEX"
							dm.TargetTable = "KEY_INDICATOR"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)

						} else { //否则 插入
							endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
							//reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])

							//获取衍生财务指标 信息
							indicData, err1 := h.CDB.GetTqFinPrgIndicDataByBizKey(compCode, endDate, reportDateType)
							if err1 != nil {
								global.LOG.Error("goCanal Insert Action TQ_FIN_PRGFINMAININDEX 根据业务主键获取衍生财务指标出错:", zap.Any("err", err1))
							}
							defVal := "0.000000"
							if indicData != nil {

								naps := indicData.Naps
								if naps == "" || naps == "null" {
									naps = defVal
								}
								insertedMap["NAPS"] = naps //每股净资产

								opncfps := indicData.Opncfps
								if opncfps == "" || opncfps == "null" {
									opncfps = defVal
								}
								insertedMap["OPNCFPS"] = opncfps //每股经营性现金流量

								roeavg := indicData.Roeavg
								if roeavg == "" || roeavg == "null" {
									roeavg = defVal
								}
								insertedMap["ROEWEIGHTED"] = roeavg //加权净资产收益率

								roediluted := indicData.Roediluted
								if roediluted == "" || roediluted == "null" {
									roediluted = defVal
								}
								insertedMap["ROEDILUTED"] = roediluted //摊薄净资产收益率

								crps := indicData.Crps
								if crps == "" || crps == "null" {
									crps = defVal
								}
								insertedMap["CRPS"] = crps //每股资本公积金

								upps := indicData.Upps
								if upps == "" || upps == "null" {
									upps = defVal
								}
								insertedMap["UPPS"] = upps //每股未分配利润

								snpMargInconms := indicData.Sgpmargin //销售毛利率
								if snpMargInconms == "" || snpMargInconms == "null" {
									snpMargInconms = defVal
								}
								insertedMap["SNPMARGINCONMS"] = snpMargInconms //销售毛利率

								opprort := indicData.Opprort
								if opprort == "" || opprort == "null" {
									opprort = defVal
								}
								insertedMap["OPPRORT"] = opprort //营业利润率

								currentRt := indicData.Currentrt
								if currentRt == "" || currentRt == "null" {
									currentRt = defVal
								}
								insertedMap["CURRENTRT"] = currentRt //流动比率

								quickRt := indicData.Quickrt
								if quickRt == "" || quickRt == "null" {
									quickRt = defVal
								}
								insertedMap["QUICKRT"] = quickRt //速动比率
							}

							//获取衍生财务指标副表信息
							indicDataSub, err2 := h.CDB.GetTqFinPrgIndicDataSubByBizKey(compCode, endDate, reportDateType)
							if err2 != nil {
								global.LOG.Error("goCanal Insert Action TQ_FIN_PRGFINMAININDEX 根据业务主键获取衍生财务指标副表出错:", zap.Any("err", err2))
							}

							if indicDataSub != nil {
								profitRatio := indicDataSub.Profitratio
								if profitRatio == "" || profitRatio == "null" {
									profitRatio = defVal
								}

								insertedMap["PROFITRATIO"] = profitRatio //净利润率(%)
							}

							affected, err3 := h.TDB.InsertKeyIndicatorSingle(INSERT_KEY_INDICATOR_SQL, insertedMap)
							if err3 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增主要财务指标(产品表）出错:", zap.Any("err", err3))
							} else {
								global.LOG.Info("goCanal 新增主要财务指标(产品表）成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增财务主要指标数据"
							dm.SourceTable = "TQ_FIN_PRGFINMAININDEX"
							dm.TargetTable = "KEY_INDICATOR"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err3 != nil {
								dm.ErrInfo = err3.Error()
							}
							rows = append(rows, dm)
						}

						//最新指标
						im := make(map[string]string)

						im["EXCHANGE"] = TransferExchane(symbol.Exchange)
						im["REPORTYEAR"] = reportYear //会计年度
						im["SYMBOL"] = symbol.Symbol
						im["COMPCODE"] = compCode
						rdt := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
						im["REPORTDATETYPE"] = rdt //报告期类型
						epsbasicEpscut := fmt.Sprintf("%v", insertedMap["EPSBASICEPSCUT"])
						if epsbasicEpscut == "<nil>" {
							epsbasicEpscut = "0.000000"
						}
						im["EPSBASICEPSCUT"] = epsbasicEpscut

						// 查询 TQ_SK_FUNDAMENTALS 股票基本面简表信息
						endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
						if endDate == "<nil>" {
							endDate = ""
						}
						dundamentals, err2 := h.CDB.GetTqSkFundamentalsBySymbolAndEndDate(symbol.Symbol, endDate)
						if err2 != nil {
							global.LOG.Error("goCanal 新增最新指标表,获取 TQ_SK_FUNDAMENTALS股票基本面简表信息出错:", zap.Any("err", err2))
						}

						if dundamentals != nil && len(dundamentals) > 0 {
							d := dundamentals[0]

							basiceps := d.Basiceps
							if basiceps == "" {
								basiceps = "0.0000"
							}
							im["BASICEPS"] = basiceps

							naps := d.Naps
							if naps == "" {
								naps = "0.0000"
							}
							im["NAPS"] = naps

							totalshare := d.Totalshare
							if totalshare == "" {
								totalshare = "0.0000"
							}
							im["TOTALSHARE"] = totalshare

							roe := d.Roe
							if roe == "" {
								roe = "0.00"
							}
							im["ROE"] = roe

							opercfps := d.Opercfps
							if opercfps == "" {
								opercfps = "0.0000"
							}
							im["OPERCFPS"] = opercfps

							npgrt := d.Npgrt
							if npgrt == "" {
								npgrt = "0.00"
							}
							im["NPGRT"] = npgrt

						}

						//查询TQ_FIN_PRGINCSTATEMENTNEW,一般企业利润表(新准则产品表)信息
						prgIncStsNews, err3 := h.CDB.GetPrgIncStatementNewByCompCodeAndEndDate(compCode, endDate)
						if err3 != nil {
							global.LOG.Error("goCanal 新增最新指标表,查询TQ_FIN_PRGINCSTATEMENTNEW 一般企业利润表(新准则产品表)信息出错:", zap.Any("err", err3))
						}

						if prgIncStsNews != nil && len(prgIncStsNews) > 0 {
							s := prgIncStsNews[0]
							bizInco := s.Bizinco
							if bizInco == "" {
								bizInco = "0.000000"
							}
							netProfit := s.Netprofit
							if netProfit == "" {
								netProfit = "0.000000"
							}
							im["BIZINCO"] = bizInco
							im["NETPROFIT"] = netProfit
						}

						//查询TQ_FIN_PRGINDICDATA 衍生财务指标(产品表)_V3表信息
						indicDatas, err4 := h.CDB.GetPrgIndicDataByCompCodeAndEndDate(compCode, endDate)
						if err4 != nil {
							global.LOG.Error("goCanal 新增最新指标表,查询TQ_FIN_PRGINDICDATA 衍生财务指标(产品表)_V3表 信息出错:", zap.Any("err", err4))
						}
						if indicDatas != nil && len(indicDatas) > 0 {
							i := indicDatas[0]

							sgpmargin := i.Sgpmargin
							if sgpmargin == "" {
								sgpmargin = "0.000000"
							}
							npcut := i.Npcut
							if npcut == "" {
								npcut = "0.000000"
							}
							im["SGPMARGIN"] = sgpmargin
							im["NPCUT"] = npcut

						}

						//查询 TQ_FIN_PRGINDICDATASUB 衍生财务指标副表(产品表)_V3表信息
						indicDataSubs, err5 := h.CDB.GetPrgIndicDataSubByCompCodeAndEndDate(compCode, endDate)
						if err5 != nil {
							global.LOG.Error("goCanal 新增最新指标表,查询TQ_FIN_PRGINDICDATASUB 衍生财务指标副表(产品表)_V3表信息 信息出错:", zap.Any("err", err5))
						}

						if indicDataSubs != nil && len(indicDataSubs) > 0 {
							sub := indicDataSubs[0]
							operinyoyb := sub.Operinyoyb
							if operinyoyb == "" {
								operinyoyb = "0.000000"
							}
							netinpnrplyoyb := sub.Netinpnrplyoyb
							if netinpnrplyoyb == "" {
								netinpnrplyoyb = "0.000000"
							}
							im["OPERINYOYB"] = operinyoyb
							im["NETINPNRPLYOYB"] = netinpnrplyoyb
						}

						//最新指标
						affectedLi, err1 := h.TDB.InsertLatestIndicatorSingle(INSERT_LATEST_INDICATOR_SQL, im) // 更新主要指标
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增最新指标表出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 新增最新指标表）成功:", zap.Int64("nums", affectedLi))
						}

						//记录操作日志
						dm2 := new(domain.DATA_MONITOR)
						dm2.Action = INSERT_ACTION
						dm2.BizDesc = "新增最新指标数据"
						dm2.SourceTable = "TQ_FIN_PRGFINMAININDEX"
						dm2.TargetTable = "LATEST_INDICATOR"
						r0json2, _ := json.Marshal(e.Rows[0])
						dm2.SourceDataJson = string(r0json2)   //新增的值
						dm2.ModifiedDataJson = string(r0json2) //新增后的值
						dm2.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm2.ErrInfo = err1.Error()
						}
						rows = append(rows, dm2)

					}

					//插入操作日志
					if len(rows) > 0 {
						affDm, errL := h.TDB.InsertDataMonitor(rows)
						if errL != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", errL))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}
				}

			}
			// 删除操作，主要更新值为空
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				//只删除合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 {
					compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal delete.获取symbol失败:", zap.Any("err", err))
					}

					//记录操作日志
					var rows []*domain.DATA_MONITOR

					zeroVal := "0.000000"
					updateMap := make(map[string]string)

					for _, symbol := range symbols {
						updateMap["SYMBOL"] = symbol.Symbol
						updateMap["EPSBASIC"] = zeroVal //基本每股收益
						//updateMap["NAPS"] = zeroVal        //每股净资产
						//updateMap["OPNCFPS"] = zeroVal     //每股经营活动产生的现金流量净额
						//updateMap["ROEWEIGHTED"] = zeroVal //净资产收益率_加权
						//updateMap["ROEDILUTED"] = zeroVal  //净资产收益率_摊薄

						//设置通用map key值
						ry := fmt.Sprintf("%v", deletedMap["REPORTYEAR"])
						if ry == "<nil>" {
							ry = ""
						}
						updateMap["REPORTYEAR"] = ry //会计年度
						rdt := fmt.Sprintf("%v", deletedMap["REPORTDATETYPE"])
						if rdt == "<nil>" {
							rdt = ""
						}
						updateMap["REPORTDATETYPE"] = rdt //报告期类型
						cpc := fmt.Sprintf("%v", deletedMap["COMPCODE"])
						updateMap["COMPCODE"] = cpc // 公司内码

						affected, err1 := h.TDB.UpdateKeyIndicator(updateMap) // 更新主要指标
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal Delete Action 更改主要财务指标(产品表）出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal Delete Action 更改主要财务指标(产品表）成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = DELETE_ACTION
						dm.BizDesc = "删除财务主要指标数据"
						dm.SourceTable = "TQ_FIN_PRGFINMAININDEX"
						dm.TargetTable = "KEY_INDICATOR"
						dm.ModifiedDataJson = "" //删除后的值为空

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //删除前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)
					}

					//最新指标
					for _, symbol := range symbols {
						//设置symbol
						updateMap["SYMBOL"] = symbol.Symbol
						updateMap["COMPCODE"] = compCode
						ry := fmt.Sprintf("%v", deletedMap["REPORTYEAR"])
						if ry == "<nil>" {
							ry = ""
						}
						updateMap["REPORTYEAR"] = ry //会计年度
						rdt := fmt.Sprintf("%v", deletedMap["REPORTDATETYPE"])
						if rdt == "<nil>" {
							rdt = ""
						}
						updateMap["REPORTDATETYPE"] = rdt     //报告期类型
						updateMap["EPSBASICEPSCUT"] = zeroVal //扣除非经常性损益后的基本每股收益

						affectedli, err1 := h.TDB.UpdateLatestIndicator(updateMap) // 更新最新指标
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 删除最新指标表出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 删除最新指标表 成功:", zap.Int64("nums", affectedli))
						}

						//记录操作日志
						dm2 := new(domain.DATA_MONITOR)
						dm2.Action = DELETE_ACTION
						dm2.BizDesc = "删除最新指标数据"
						dm2.SourceTable = "TQ_FIN_PRGFINMAININDEX"
						dm2.TargetTable = "LATEST_INDICATOR"
						dm2.ModifiedDataJson = "" //删除后的值为空

						r0json2, _ := json.Marshal(e.Rows[0])
						dm2.SourceDataJson = string(r0json2) //删除前的值
						dm2.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm2.ErrInfo = err1.Error()
						}
						rows = append(rows, dm2)
					}

					//插入操作日志
					if len(rows) > 0 {
						affDm, err2 := h.TDB.InsertDataMonitor(rows)
						if err2 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}
				}

			}
		}
		//衍生财务指标(产品表)_V3
		if e.Table.Name == "TQ_FIN_PRGINDICDATA" || e.Table.Name == "tq_fin_prgindicdata" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 只更新 合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					// 记录操作日志
					var rows []*domain.DATA_MONITOR

					compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if symbols != nil {
						for _, symbol := range symbols {

							keyIndicatorUpdateMap["SYMBOL"] = symbol.Symbol
							crps := fmt.Sprintf("%v", updatedMap["CRPS"])
							if crps == "<nil>" {
								crps = "0"
							}
							keyIndicatorUpdateMap["CRPS"] = crps //每股资本公积金
							upps := fmt.Sprintf("%v", updatedMap["UPPS"])
							if upps == "<nil>" {
								upps = "0"
							}
							keyIndicatorUpdateMap["UPPS"] = upps //每股未分配利润
							snpmarginconms := fmt.Sprintf("%v", updatedMap["SNPMARGINCONMS"])
							if snpmarginconms == "<nil>" {
								snpmarginconms = "0"
							}
							keyIndicatorUpdateMap["SNPMARGINCONMS"] = snpmarginconms //销售毛利率
							opprort := fmt.Sprintf("%v", updatedMap["OPPRORT"])
							if opprort == "<nil>" {
								opprort = "0"
							}
							keyIndicatorUpdateMap["OPPRORT"] = opprort //营业利润率
							currentrt := fmt.Sprintf("%v", updatedMap["CURRENTRT"])
							if currentrt == "<nil>" {
								currentrt = "0"
							}
							keyIndicatorUpdateMap["CURRENTRT"] = currentrt //流动比率
							quickrt := fmt.Sprintf("%v", updatedMap["QUICKRT"])
							if quickrt == "<nil>" {
								quickrt = "0"
							}

							naps := fmt.Sprintf("%v", updatedMap["NAPS"])
							if naps == "<nil>" {
								naps = "0"
							}
							keyIndicatorUpdateMap["NAPS"] = naps //每股净资产

							opncfps := fmt.Sprintf("%v", updatedMap["OPNCFPS"])
							if opncfps == "<nil>" {
								opncfps = "0"
							}
							keyIndicatorUpdateMap["OPNCFPS"] = opncfps //每股经营活动产生的现金流量净额

							roeweighted := fmt.Sprintf("%v", updatedMap["ROEWEIGHTED"])
							if roeweighted == "<nil>" {
								roeweighted = "0"
							}
							keyIndicatorUpdateMap["ROEWEIGHTED"] = roeweighted //净资产收益率_加权

							roediluted := fmt.Sprintf("%v", updatedMap["ROEDILUTED"])
							if roediluted == "<nil>" {
								roediluted = "0"
							}
							keyIndicatorUpdateMap["ROEDILUTED"] = roediluted //净资产收益率_摊薄

							keyIndicatorUpdateMap["QUICKRT"] = quickrt //速动比率
							//设置通用map key值
							ry := fmt.Sprintf("%v", updatedMap["REPORTYEAR"])
							keyIndicatorUpdateMap["REPORTYEAR"] = ry //会计年度
							rdt := fmt.Sprintf("%v", updatedMap["REPORTDATETYPE"])
							keyIndicatorUpdateMap["REPORTDATETYPE"] = rdt //报告期类型
							cpc := fmt.Sprintf("%v", updatedMap["COMPCODE"])
							keyIndicatorUpdateMap["COMPCODE"] = cpc // 公司内码

							affected, err1 := h.TDB.UpdateKeyIndicator(keyIndicatorUpdateMap) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 更改衍生财务指标(产品表)_V3出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 更改衍生财务指标(产品表)_V3成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = UPDATE_ACTION
							dm.BizDesc = "更新财务主要指标数据"
							dm.SourceTable = "TQ_FIN_PRGINDICDATA"
							dm.TargetTable = "KEY_INDICATOR"

							r1json, _ := json.Marshal(e.Rows[1])
							dm.ModifiedDataJson = string(r1json) //更改后的值

							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json) //更改前的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)

						}
					}

					//最新指标
					um := make(map[string]string)
					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							um["SYMBOL"] = symbol.Symbol
							um["COMPCODE"] = compCode
							if err != nil {
								global.LOG.Error("goCanal update.获取symbol失败:", zap.Any("err", err))
							}

							sgpmarGin := fmt.Sprintf("%v", updatedMap["SGPMARGIN"])
							if sgpmarGin == "<nil>" {
								sgpmarGin = "0"
							}
							um["SGPMARGIN"] = sgpmarGin
							npcut := fmt.Sprintf("%v", updatedMap["NPCUT"])
							if npcut == "<nil>" {
								npcut = "0"
							}
							um["NPCUT"] = npcut

							affectedLi, err1 := h.TDB.UpdateLatestIndicator(um) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 更改最新指标表出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 更改最新指标表）成功:", zap.Int64("nums", affectedLi))
							}

							//记录操作日志
							dm2 := new(domain.DATA_MONITOR)
							dm2.Action = UPDATE_ACTION
							dm2.BizDesc = "更新最新指标数据"
							dm2.SourceTable = "TQ_FIN_PRGINDICDATA"
							dm2.TargetTable = "LATEST_INDICATOR"

							r1json2, _ := json.Marshal(e.Rows[1])
							dm2.ModifiedDataJson = string(r1json2) //更改后的值

							r0json2, _ := json.Marshal(e.Rows[0])
							dm2.SourceDataJson = string(r0json2) //更改前的值
							dm2.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm2.ErrInfo = err1.Error()
							}
							rows = append(rows, dm2)
						}
					}

					if len(rows) > 0 {
						//插入操作日志
						affDm, el := h.TDB.InsertDataMonitor(rows)
						if el != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", el))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}

				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}
				// 只新增 合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
						return err
					}

					// 记录操作日志
					var rows []*domain.DATA_MONITOR

					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							insertedMap["SYMBOL"] = symbol.Symbol
							insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

							reportYear := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
							reportDateType := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
							has, _ := h.TDB.HasKeyIndicator(compCode, symbol.Symbol, reportYear, reportDateType)
							if has { //如果存在则更新
								updateMap := make(map[string]string)

								naps := fmt.Sprintf("%v", insertedMap["NAPS"]) //每股净资产
								if naps == "<nil>" {
									naps = "0"
								}
								updateMap["NAPS"] = naps //每股净资产

								opncfps := fmt.Sprintf("%v", insertedMap["OPNCFPS"])
								if opncfps == "<nil>" {
									opncfps = "0"
								}
								updateMap["OPNCFPS"] = opncfps //每股经营性现金流量

								roeavg := fmt.Sprintf("%v", insertedMap["ROEWEIGHTED"])
								if roeavg == "<nil>" {
									roeavg = "0"
								}
								updateMap["ROEWEIGHTED"] = roeavg //加权净资产收益率

								roediluted := fmt.Sprintf("%v", insertedMap["ROEDILUTED"])
								if roediluted == "<nil>" {
									roediluted = "0"
								}
								updateMap["ROEDILUTED"] = roediluted //摊薄净资产收益率

								crps := fmt.Sprintf("%v", insertedMap["CRPS"])
								if crps == "<nil>" {
									crps = "0"
								}
								updateMap["CRPS"] = crps //每股资本公积金
								upps := fmt.Sprintf("%v", insertedMap["UPPS"])
								if upps == "<nil>" {
									upps = "0"
								}
								updateMap["UPPS"] = upps //每股未分配利润
								snpmarginconms := fmt.Sprintf("%v", insertedMap["SNPMARGINCONMS"])
								if snpmarginconms == "<nil>" {
									snpmarginconms = "0"
								}
								updateMap["SNPMARGINCONMS"] = snpmarginconms //销售毛利率
								opprort := fmt.Sprintf("%v", insertedMap["OPPRORT"])
								if opprort == "<nil>" {
									opprort = "0"
								}
								updateMap["OPPRORT"] = opprort //营业利润率
								currentrt := fmt.Sprintf("%v", insertedMap["CURRENTRT"])
								if currentrt == "<nil>" {
									currentrt = "0"
								}
								updateMap["CURRENTRT"] = currentrt //流动比率
								quickrt := fmt.Sprintf("%v", insertedMap["QUICKRT"])
								if quickrt == "<nil>" {
									quickrt = "0"
								}
								updateMap["QUICKRT"] = quickrt //速动比率
								//设置通用map key值
								ry := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
								updateMap["REPORTYEAR"] = ry //会计年度
								rdt := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
								updateMap["REPORTDATETYPE"] = rdt //报告期类型
								cpc := fmt.Sprintf("%v", insertedMap["COMPCODE"])
								updateMap["COMPCODE"] = cpc // 公司内码

								affected, err1 := h.TDB.UpdateKeyIndicator(updateMap) // 更新主要指标
								if err1 != nil {
									//仅记录出错日志，不退出程序，
									global.LOG.Error("goCanal Insert Action 更新衍生财务指标(产品表)_V3 出错:", zap.Any("err", err))
								} else {
									global.LOG.Info("goCanal Insert Action 更新衍生财务指标(产品表)_V3 成功:", zap.Int64("nums", affected))
								}

								dm := new(domain.DATA_MONITOR)
								dm.Action = INSERT_ACTION
								dm.BizDesc = "新增财务主要指标数据"
								dm.SourceTable = "TQ_FIN_PRGINDICDATA"
								dm.TargetTable = "KEY_INDICATOR"
								r0json, _ := json.Marshal(e.Rows[0])
								dm.SourceDataJson = string(r0json)   //新增的值
								dm.ModifiedDataJson = string(r0json) //新增后的值
								dm.ActionTime = utils.GetNowTimeStr()
								if err1 != nil {
									dm.ErrInfo = err1.Error()
								}
								rows = append(rows, dm)

							} else { //如果没有则进行插入
								defVal := "0.000000"
								endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
								//reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])

								naps := fmt.Sprintf("%v", insertedMap["NAPS"]) //每股净资产
								if naps == "<nil>" {
									naps = "0.0000"
								}
								insertedMap["NAPS"] = naps //每股净资产

								opncfps := fmt.Sprintf("%v", insertedMap["OPNCFPS"])
								if opncfps == "<nil>" {
									opncfps = "0.0000"
								}
								insertedMap["OPNCFPS"] = opncfps //每股经营性现金流量

								roeavg := fmt.Sprintf("%v", insertedMap["ROEWEIGHTED"])
								if roeavg == "<nil>" {
									roeavg = "0"
								}
								insertedMap["ROEWEIGHTED"] = roeavg //加权净资产收益率

								roediluted := fmt.Sprintf("%v", insertedMap["ROEDILUTED"])
								if roediluted == "<nil>" {
									roediluted = "0"
								}
								insertedMap["ROEDILUTED"] = roediluted //摊薄净资产收益率

								snpmarginconms := fmt.Sprintf("%v", insertedMap["SNPMARGINCONMS"])
								if snpmarginconms == "<nil>" {
									snpmarginconms = "0"
								}
								insertedMap["SNPMARGINCONMS"] = snpmarginconms //销售毛利率

								//获取衍生财务指标副表信息
								indicDataSub, err1 := h.CDB.GetTqFinPrgIndicDataSubByBizKey(compCode, endDate, reportDateType)
								if err1 != nil {
									global.LOG.Error("goCanal Insert Action TQ_FIN_PRGINDICDATA 根据业务主键获取衍生财务指标副表出错:", zap.Any("err", err1))
								}

								if indicDataSub != nil {
									profitRatio := indicDataSub.Profitratio
									if profitRatio == "" || profitRatio == "null" {
										profitRatio = defVal
									}

									insertedMap["PROFITRATIO"] = profitRatio //净利润率(%)
								}

								//获取主要财务指标数据
								mainIndex, err2 := h.CDB.GetTqFinPrgFinMainIndexByBizKey(compCode, endDate, reportDateType)
								if err2 != nil {
									global.LOG.Error("goCanal Insert Action TQ_FIN_PRGINDICDATA 根据业务主键获取主要财务指标出错:", zap.Any("err", err1))
								}

								if mainIndex != nil {
									epsBasic := mainIndex.Epsbasic
									if epsBasic == "" || epsBasic == "null" {
										epsBasic = defVal
									}
									insertedMap["EPSBASIC"] = epsBasic //基本每股收益

									/*
										naps := mainIndex.Naps
										if naps == "" || naps == "null" {
											naps = defVal
										}
										insertedMap["NAPS"] = naps //每股净资产

										opnCfps := mainIndex.Opncfps
										if opnCfps == "" || opnCfps == "null" {
											opnCfps = defVal
										}
										insertedMap["OPNCFPS"] = opnCfps //	每股经营活动产生的现金流量净额

										roeWeighted := mainIndex.Roeweighted
										if roeWeighted == "" || roeWeighted == "null" {
											roeWeighted = defVal
										}
										insertedMap["ROEWEIGHTED"] = roeWeighted //净资产收益率_加权

										roeDiluted := mainIndex.Roediluted
										if roeDiluted == "" || roeDiluted == "null" {
											roeDiluted = defVal
										}
										insertedMap["ROEDILUTED"] = roeDiluted // 净资产收益率_摊薄
									*/
								}

								//不存在则新增
								affected, err3 := h.TDB.InsertKeyIndicatorSingle(INSERT_KEY_INDICATOR_SQL, insertedMap)
								if err3 != nil {
									//仅记录出错日志，不退出程序，
									global.LOG.Error("goCanal 新增衍生财务指标(产品表)_V3 出错:", zap.Any("err", err3))
								} else {
									global.LOG.Info("goCanal v新增衍生财务指标(产品表)_V3成功:", zap.Int64("nums", affected))
								}

								dm := new(domain.DATA_MONITOR)
								dm.Action = INSERT_ACTION
								dm.BizDesc = "新增财务主要指标数据"
								dm.SourceTable = "TQ_FIN_PRGINDICDATA"
								dm.TargetTable = "KEY_INDICATOR"
								r0json, _ := json.Marshal(e.Rows[0])
								dm.SourceDataJson = string(r0json)   //新增的值
								dm.ModifiedDataJson = string(r0json) //新增后的值
								dm.ActionTime = utils.GetNowTimeStr()
								if err3 != nil {
									dm.ErrInfo = err3.Error()
								}
								rows = append(rows, dm)

							}

							im := make(map[string]string)
							im["EXCHANGE"] = symbol.Exchange
							im["SYMBOL"] = symbol.Symbol
							im["COMPCODE"] = compCode

							sgpmargin := fmt.Sprintf("%v", insertedMap["SGPMARGIN"]) //销售毛利率
							if sgpmargin == "<nil>" {
								sgpmargin = "0.000000"
							}
							im["SGPMARGIN"] = sgpmargin //销售毛利率

							cpcut := fmt.Sprintf("%v", insertedMap["NPCUT"]) //扣除非经常性损益后的净利润
							if cpcut == "<nil>" {
								cpcut = "0.000000"
							}
							im["NPCUT"] = cpcut //扣除非经常性损益后的净利润

							// 查询 TQ_SK_FUNDAMENTALS 股票基本面简表信息
							endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
							if endDate == "<nil>" {
								endDate = ""
							}
							dundamentals, err2 := h.CDB.GetTqSkFundamentalsBySymbolAndEndDate(symbol.Symbol, endDate)
							if err2 != nil {
								global.LOG.Error("goCanal 新增最新指标表,获取 TQ_SK_FUNDAMENTALS股票基本面简表信息出错:", zap.Any("err", err2))
							}

							if dundamentals != nil && len(dundamentals) > 0 {
								d := dundamentals[0]

								basiceps := d.Basiceps
								if basiceps == "" {
									basiceps = "0.0000"
								}
								im["BASICEPS"] = basiceps

								naps := d.Naps
								if naps == "" {
									naps = "0.0000"
								}
								im["NAPS"] = naps

								totalshare := d.Totalshare
								if totalshare == "" {
									totalshare = "0.0000"
								}
								im["TOTALSHARE"] = totalshare

								roe := d.Roe
								if roe == "" {
									roe = "0.00"
								}
								im["ROE"] = roe

								opercfps := d.Opercfps
								if opercfps == "" {
									opercfps = "0.0000"
								}
								im["OPERCFPS"] = opercfps

								npgrt := d.Npgrt
								if npgrt == "" {
									npgrt = "0.00"
								}
								im["NPGRT"] = npgrt

							}

							//查询TQ_FIN_PRGFINMAININDEX 主要财务指标(产品表）信息
							prgFinMaindexs, err3 := h.CDB.GetPrgFinMainIndexByCompCodeAndEndDate(compCode, endDate)
							if err3 != nil {
								global.LOG.Error("goCanal 更新最新指标表,获取Q_FIN_PRGFINMAININDEX 主要财务指标(产品表）信息出错:", zap.Any("err", err3))
							}
							if prgFinMaindexs != nil && len(prgFinMaindexs) > 0 {
								p := prgFinMaindexs[0]
								ry := p.Reportyear
								rdt := p.Reportdatetype
								epsbasicepscut := p.Epsbasicepscut
								if epsbasicepscut == "" {
									epsbasicepscut = "0.000000"
								}
								im["REPORTYEAR"] = ry
								im["REPORTDATETYPE"] = rdt
								im["EPSBASICEPSCUT"] = epsbasicepscut
							}

							//查询TQ_FIN_PRGINCSTATEMENTNEW,一般企业利润表(新准则产品表)信息
							prgIncStsNews, err4 := h.CDB.GetPrgIncStatementNewByCompCodeAndEndDate(compCode, endDate)
							if err4 != nil {
								global.LOG.Error("goCanal 更新最新指标表,查询TQ_FIN_PRGINCSTATEMENTNEW 一般企业利润表(新准则产品表)信息出错:", zap.Any("err", err4))
							}

							if prgIncStsNews != nil && len(prgIncStsNews) > 0 {
								s := prgIncStsNews[0]
								bizInco := s.Bizinco
								if bizInco == "" {
									bizInco = "0.000000"
								}
								netProfit := s.Netprofit
								if netProfit == "" {
									netProfit = "0.000000"
								}
								im["BIZINCO"] = bizInco
								im["NETPROFIT"] = netProfit
							}

							//查询 TQ_FIN_PRGINDICDATASUB 衍生财务指标副表(产品表)_V3表信息
							indicDataSubs, err6 := h.CDB.GetPrgIndicDataSubByCompCodeAndEndDate(compCode, endDate)
							if err6 != nil {
								global.LOG.Error("goCanal 更新最新指标表,查询TQ_FIN_PRGINDICDATASUB 衍生财务指标副表(产品表)_V3表信息 信息出错:", zap.Any("err", err6))
							}

							if indicDataSubs != nil && len(indicDataSubs) > 0 {
								sub := indicDataSubs[0]
								operinyoyb := sub.Operinyoyb
								if operinyoyb == "" {
									operinyoyb = "0.000000"
								}
								netinpnrplyoyb := sub.Netinpnrplyoyb
								if netinpnrplyoyb == "" {
									netinpnrplyoyb = "0.00000"
								}
								im["OPERINYOYB"] = operinyoyb
								im["NETINPNRPLYOYB"] = netinpnrplyoyb
							}
							//最新指标
							affectedLi, err1 := h.TDB.InsertLatestIndicatorSingle(INSERT_LATEST_INDICATOR_SQL, im) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增最新指标表出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 新增最新指标表）成功:", zap.Int64("nums", affectedLi))
							}

							//记录操作日志
							dm2 := new(domain.DATA_MONITOR)
							dm2.Action = INSERT_ACTION
							dm2.BizDesc = "新增最新指标数据"
							dm2.SourceTable = "TQ_FIN_PRGINDICDATA"
							dm2.TargetTable = "LATEST_INDICATOR"
							r0json2, _ := json.Marshal(e.Rows[0])
							dm2.SourceDataJson = string(r0json2)   //新增的值
							dm2.ModifiedDataJson = string(r0json2) //新增后的值
							dm2.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm2.ErrInfo = err1.Error()
							}
							rows = append(rows, dm2)

						}
					}

					//插入操作日志
					if len(rows) > 0 {
						affDm, el := h.TDB.InsertDataMonitor(rows)
						if el != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", el))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}
				}

			}
			// 删除操作，主要更新值为空
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				// 只删除 合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					//记录操作日志
					var rows []*domain.DATA_MONITOR
					compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal delete.获取symbol失败:", zap.Any("err", err))
						return err
					}

					zeroVal := "0.000000"
					updateMap := make(map[string]string)
					if symbols != nil {
						for _, symbol := range symbols {
							updateMap["SYMBOL"] = symbol.Symbol
							updateMap["CRPS"] = zeroVal           //每股资本公积金
							updateMap["UPPS"] = zeroVal           //每股未分配利润
							updateMap["SNPMARGINCONMS"] = zeroVal //销售毛利率
							updateMap["OPPRORT"] = zeroVal        //营业利润率
							updateMap["CURRENTRT"] = zeroVal      //流动比率
							updateMap["QUICKRT"] = zeroVal

							updateMap["NAPS"] = zeroVal        //每股净资产
							updateMap["OPNCFPS"] = zeroVal     //每股经营性现金流量
							updateMap["ROEWEIGHTED"] = zeroVal //加权净资产收益率
							updateMap["ROEDILUTED"] = zeroVal  //摊薄净资产收益率

							//设置通用map key值
							ry := fmt.Sprintf("%v", deletedMap["REPORTYEAR"])
							updateMap["REPORTYEAR"] = ry //会计年度
							rdt := fmt.Sprintf("%v", deletedMap["REPORTDATETYPE"])
							updateMap["REPORTDATETYPE"] = rdt //报告期类型
							cpc := fmt.Sprintf("%v", deletedMap["COMPCODE"])
							updateMap["COMPCODE"] = cpc // 公司内码

							affected, err1 := h.TDB.UpdateKeyIndicator(updateMap) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal Delete Action 衍生财务指标(产品表)_V3 出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal Delete Action 衍生财务指标(产品表)_V3成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = DELETE_ACTION
							dm.BizDesc = "删除财务主要指标数据"
							dm.SourceTable = "TQ_FIN_PRGINDICDATA"
							dm.TargetTable = "KEY_INDICATOR"
							dm.ModifiedDataJson = "" //删除后的值为空

							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json) //删除前的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)
						}

						//最新指标
						//compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
						//symbols, err := h.CDB.GetSymbolByCompCode(compCode)
						//if err != nil {
						//	global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
						//}

						for _, symbol := range symbols {
							//设置symbol
							updateMap["SYMBOL"] = symbol.Symbol
							updateMap["COMPCODE"] = compCode // 公司内码
							updateMap["SGPMARGIN"] = zeroVal //销售毛利率
							updateMap["NPCUT"] = zeroVal     //扣除非经常性损益后的净利润

							affectedli, err1 := h.TDB.UpdateLatestIndicator(updateMap) // 更新最新指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 删除最新指标表出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 删除最新指标表）成功:", zap.Int64("nums", affectedli))
							}

							//记录操作日志
							dm2 := new(domain.DATA_MONITOR)
							dm2.Action = DELETE_ACTION
							dm2.BizDesc = "删除最新指标数据"
							dm2.SourceTable = "TQ_FIN_PRGINDICDATA"
							dm2.TargetTable = "LATEST_INDICATOR"
							dm2.ModifiedDataJson = "" //删除后的值为空

							r0json2, _ := json.Marshal(e.Rows[0])
							dm2.SourceDataJson = string(r0json2) //删除前的值
							dm2.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm2.ErrInfo = err1.Error()
							}
							rows = append(rows, dm2)
						}
					} // end of symbols != nil
					if len(rows) > 0 {
						//插入操作日志
						affDm, el := h.TDB.InsertDataMonitor(rows)
						if el != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", el))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}

				}

			}

		}
		//衍生财务指标副表(产品表)_V3
		if e.Table.Name == "TQ_FIN_PRGINDICDATASUB" || e.Table.Name == "tq_fin_prgindicdatasub" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//	global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//	colVal := fmt.Sprintf("%v", val)
					//	global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 只更新 合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_c3 {
					// 记录操作日志
					var rows []*domain.DATA_MONITOR
					compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal update.获取symbol失败:", zap.Any("err", err))
						return err
					}
					if symbols != nil {
						for _, symbol := range symbols {
							keyIndicatorUpdateMap["SYMBOL"] = symbol.Symbol
							profitratio := fmt.Sprintf("%v", updatedMap["PROFITRATIO"])
							if profitratio == "<nil>" {
								profitratio = "0.000000"
							}
							keyIndicatorUpdateMap["PROFITRATIO"] = profitratio //净利润率(%)
							//设置通用map key值
							ry := fmt.Sprintf("%v", updatedMap["REPORTYEAR"])
							keyIndicatorUpdateMap["REPORTYEAR"] = ry //会计年度
							rdt := fmt.Sprintf("%v", updatedMap["REPORTDATETYPE"])
							keyIndicatorUpdateMap["REPORTDATETYPE"] = rdt //报告期类型
							cpc := fmt.Sprintf("%v", updatedMap["COMPCODE"])
							keyIndicatorUpdateMap["COMPCODE"] = cpc // 公司内码

							affected, err1 := h.TDB.UpdateKeyIndicator(keyIndicatorUpdateMap) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 更改衍生财务指标副表(产品表)_V3出错:", zap.Any("err1", err))
							} else {
								global.LOG.Info("goCanal 更改衍生财务指标副表(产品表)_V3成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = UPDATE_ACTION
							dm.BizDesc = "更新财务主要指标数据"
							dm.SourceTable = "TQ_FIN_PRGINDICDATASUB"
							dm.TargetTable = "KEY_INDICATOR"

							r1json, _ := json.Marshal(e.Rows[1])
							dm.ModifiedDataJson = string(r1json) //更改后的值

							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json) //更改前的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)
						}

						//最新指标
						um := make(map[string]string)

						for _, symbol := range symbols {
							//设置symbol
							um["SYMBOL"] = symbol.Symbol
							um["COMPCODE"] = compCode

							operInyoyb := fmt.Sprintf("%v", updatedMap["OPERINYOYB"])
							if operInyoyb == "<nil>" {
								operInyoyb = "0.000000"
							}
							um["OPERINYOYB"] = operInyoyb

							netInpnrpLyoyb := fmt.Sprintf("%v", updatedMap["NETINPNRPLYOYB"])
							if netInpnrpLyoyb == "<nil>" {
								netInpnrpLyoyb = "0.000000"
							}
							um["NETINPNRPLYOYB"] = netInpnrpLyoyb

							affectedLi, err1 := h.TDB.UpdateLatestIndicator(um) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 更改最新指标表出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 更改最新指标表）成功:", zap.Int64("nums", affectedLi))
							}

							//记录操作日志
							dm2 := new(domain.DATA_MONITOR)
							dm2.Action = UPDATE_ACTION
							dm2.BizDesc = "更新最新指标数据"
							dm2.SourceTable = "TQ_FIN_PRGINDICDATASUB"
							dm2.TargetTable = "LATEST_INDICATOR"

							r1json2, _ := json.Marshal(e.Rows[1])
							dm2.ModifiedDataJson = string(r1json2) //更改后的值

							r0json2, _ := json.Marshal(e.Rows[0])
							dm2.SourceDataJson = string(r0json2) //更改前的值
							dm2.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm2.ErrInfo = err1.Error()
							}
							rows = append(rows, dm2)
						}
					}

					if len(rows) > 0 {
						//插入操作日志
						affDm, el := h.TDB.InsertDataMonitor(rows)
						if el != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", el))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}

				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				// 只新增 合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_c3 {
					compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
						return err
					}

					// 记录操作日志
					var rows []*domain.DATA_MONITOR
					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							insertedMap["SYMBOL"] = symbol.Symbol
							insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

							reportYear := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
							reportDateType := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
							has, _ := h.TDB.HasKeyIndicator(compCode, symbol.Symbol, reportYear, reportDateType)

							if has {
								updateMap := make(map[string]string)

								profitratio := fmt.Sprintf("%v", insertedMap["PROFITRATIO"])
								if profitratio == "<nil>" {
									profitratio = "0"
								}
								updateMap["PROFITRATIO"] = profitratio //净利润率(%)
								//设置通用map key值
								ry := fmt.Sprintf("%v", insertedMap["REPORTYEAR"])
								updateMap["REPORTYEAR"] = ry //会计年度
								rdt := fmt.Sprintf("%v", insertedMap["REPORTDATETYPE"])
								updateMap["REPORTDATETYPE"] = rdt //报告期类型
								cpc := fmt.Sprintf("%v", insertedMap["COMPCODE"])
								updateMap["COMPCODE"] = cpc // 公司内码

								affected, err1 := h.TDB.UpdateKeyIndicator(updateMap) // 更新主要指标
								if err1 != nil {
									//仅记录出错日志，不退出程序，
									global.LOG.Error("goCanal Insert Action 衍生财务指标副表(产品表)_V3 出错:", zap.Any("err", err1))
								} else {
									global.LOG.Info("goCanal Insert Action 衍生财务指标副表(产品表)_V3 成功:", zap.Int64("nums", affected))
								}

								dm := new(domain.DATA_MONITOR)
								dm.Action = INSERT_ACTION
								dm.BizDesc = "新增财务主要指标数据"
								dm.SourceTable = "TQ_FIN_PRGINDICDATASUB"
								dm.TargetTable = "KEY_INDICATOR"
								r0json, _ := json.Marshal(e.Rows[0])
								dm.SourceDataJson = string(r0json)   //新增的值
								dm.ModifiedDataJson = string(r0json) //新增后的值
								dm.ActionTime = utils.GetNowTimeStr()
								if err1 != nil {
									dm.ErrInfo = err1.Error()
								}
								rows = append(rows, dm)

							} else {

								defVal := "0.000000"
								endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
								//reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])

								//获取主要财务指标数据
								mainIndex, err2 := h.CDB.GetTqFinPrgFinMainIndexByBizKey(compCode, endDate, reportDateType)
								if err2 != nil {
									global.LOG.Error("goCanal Insert Action TQ_FIN_PRGINDICDATASUB 根据业务主键获取主要财务指标出错:", zap.Any("err", err2))
								}

								if mainIndex != nil {
									epsBasic := mainIndex.Epsbasic
									if epsBasic == "" || epsBasic == "null" {
										epsBasic = defVal
									}
									insertedMap["EPSBASIC"] = epsBasic //基本每股收益

									/*
										naps := mainIndex.Naps
										if naps == "" || naps == "null" {
											naps = defVal
										}
										insertedMap["NAPS"] = naps //每股净资产

										opnCfps := mainIndex.Opncfps
										if opnCfps == "" || opnCfps == "null" {
											opnCfps = defVal
										}
										insertedMap["OPNCFPS"] = opnCfps //	每股经营活动产生的现金流量净额

										roeWeighted := mainIndex.Roeweighted
										if roeWeighted == "" || roeWeighted == "null" {
											roeWeighted = defVal
										}
										insertedMap["ROEWEIGHTED"] = roeWeighted //净资产收益率_加权

										roeDiluted := mainIndex.Roediluted
										if roeDiluted == "" || roeDiluted == "null" {
											roeDiluted = defVal
										}
										insertedMap["ROEDILUTED"] = roeDiluted // 净资产收益率_摊薄
									*/
								}

								//获取衍生财务指标 信息
								indicData, err1 := h.CDB.GetTqFinPrgIndicDataByBizKey(compCode, endDate, reportDateType)
								if err1 != nil {
									global.LOG.Error("goCanal Insert Action TQ_FIN_PRGINDICDATASUB 根据业务主键获取衍生财务指标出错:", zap.Any("err", err1))
								}

								if indicData != nil {

									crps := indicData.Crps
									if crps == "" || crps == "null" {
										crps = defVal
									}
									insertedMap["CRPS"] = crps //每股资本公积金

									upps := indicData.Upps
									if upps == "" || upps == "null" {
										upps = defVal
									}
									insertedMap["UPPS"] = upps //每股未分配利润

									snpMargInconms := indicData.Sgpmargin
									if snpMargInconms == "" || snpMargInconms == "null" {
										snpMargInconms = defVal
									}
									insertedMap["SNPMARGINCONMS"] = snpMargInconms //销售毛利率

									opprort := indicData.Opprort
									if opprort == "" || opprort == "null" {
										opprort = defVal
									}
									insertedMap["OPPRORT"] = opprort //营业利润率

									currentRt := indicData.Currentrt
									if currentRt == "" || currentRt == "null" {
										currentRt = defVal
									}
									insertedMap["CURRENTRT"] = currentRt //流动比率

									quickRt := indicData.Quickrt
									if quickRt == "" || quickRt == "null" {
										quickRt = defVal
									}
									insertedMap["QUICKRT"] = quickRt //速动比率

									naps := indicData.Naps
									if naps == "" || naps == "null" {
										naps = defVal
									}
									insertedMap["NAPS"] = naps //每股净资产

									opncfps := indicData.Opncfps
									if opncfps == "" || opncfps == "null" {
										opncfps = defVal
									}
									insertedMap["OPNCFPS"] = opncfps //每股经营性现金流量

									roeavg := indicData.Roeavg
									if roeavg == "" || roeavg == "null" {
										roeavg = defVal
									}
									insertedMap["ROEWEIGHTED"] = roeavg //加权净资产收益率

									roediluted := indicData.Roediluted
									if roediluted == "" || roediluted == "null" {
										roediluted = defVal
									}
									insertedMap["ROEDILUTED"] = roediluted //摊薄净资产收益率
								}

								//不存在则新增
								affected, err3 := h.TDB.InsertKeyIndicatorSingle(INSERT_KEY_INDICATOR_SQL, insertedMap)
								if err3 != nil {
									//仅记录出错日志，不退出程序，
									global.LOG.Error("goCanal 新增衍生财务指标副表(产品表)_V3  出错:", zap.Any("err", err3))
								} else {
									global.LOG.Info("ggoCanal 新增衍生财务指标副表(产品表)_V3  成功:", zap.Int64("nums", affected))
								}

								dm := new(domain.DATA_MONITOR)
								dm.Action = INSERT_ACTION
								dm.BizDesc = "新增财务主要指标数据"
								dm.SourceTable = "TQ_FIN_PRGINDICDATASUB"
								dm.TargetTable = "KEY_INDICATOR"
								r0json, _ := json.Marshal(e.Rows[0])
								dm.SourceDataJson = string(r0json)   //新增的值
								dm.ModifiedDataJson = string(r0json) //新增后的值
								dm.ActionTime = utils.GetNowTimeStr()
								if err3 != nil {
									dm.ErrInfo = err3.Error()
								}
								rows = append(rows, dm)

							}

							//最新指标
							im := make(map[string]string)
							//设置symbol
							im["SYMBOL"] = symbol.Symbol
							im["EXCHANGE"] = symbol.Exchange
							im["COMPCODE"] = compCode

							operinyoyb := fmt.Sprintf("%v", insertedMap["OPERINYOYB"])
							if operinyoyb == "<nil>" {
								operinyoyb = "0.000000"
							}
							im["OPERINYOYB"] = operinyoyb

							netinpnrplyoyb := fmt.Sprintf("%v", insertedMap["NETINPNRPLYOYB"])
							if netinpnrplyoyb == "<nil>" {
								netinpnrplyoyb = "0.000000"
							}
							im["NETINPNRPLYOYB"] = netinpnrplyoyb

							// 查询 TQ_SK_FUNDAMENTALS 股票基本面简表信息
							endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
							if endDate == "<nil>" {
								endDate = ""
							}
							dundamentals, err2 := h.CDB.GetTqSkFundamentalsBySymbolAndEndDate(symbol.Symbol, endDate)
							if err2 != nil {
								global.LOG.Error("goCanal 新增最新指标表,获取 TQ_SK_FUNDAMENTALS股票基本面简表信息出错:", zap.Any("err", err2))
							}

							if dundamentals != nil && len(dundamentals) > 0 {
								d := dundamentals[0]

								basiceps := d.Basiceps
								if basiceps == "" {
									basiceps = "0.0000"
								}
								im["BASICEPS"] = basiceps

								naps := d.Naps
								if naps == "" {
									naps = "0.0000"
								}
								im["NAPS"] = naps

								totalshare := d.Totalshare
								if totalshare == "" {
									totalshare = "0.0000"
								}
								im["TOTALSHARE"] = totalshare

								roe := d.Roe
								if roe == "" {
									roe = "0.00"
								}
								im["ROE"] = roe

								opercfps := d.Opercfps
								if opercfps == "" {
									opercfps = "0.0000"
								}
								im["OPERCFPS"] = opercfps

								npgrt := d.Npgrt
								if npgrt == "" {
									npgrt = "0.00"
								}
								im["NPGRT"] = npgrt

							}

							//查询TQ_FIN_PRGFINMAININDEX 主要财务指标(产品表）信息
							prgFinMaindexs, err3 := h.CDB.GetPrgFinMainIndexByCompCodeAndEndDate(compCode, endDate)
							if err3 != nil {
								global.LOG.Error("goCanal 更新最新指标表,获取Q_FIN_PRGFINMAININDEX 主要财务指标(产品表）信息出错:", zap.Any("err", err3))
							}
							if prgFinMaindexs != nil && len(prgFinMaindexs) > 0 {
								p := prgFinMaindexs[0]
								ry := p.Reportyear
								rdt := p.Reportdatetype
								epsbasicepscut := p.Epsbasicepscut
								if epsbasicepscut == "" {
									epsbasicepscut = "0.000000"
								}
								im["REPORTYEAR"] = ry
								im["REPORTDATETYPE"] = rdt
								im["EPSBASICEPSCUT"] = epsbasicepscut
							}

							//查询TQ_FIN_PRGINCSTATEMENTNEW,一般企业利润表(新准则产品表)信息
							prgIncStsNews, err4 := h.CDB.GetPrgIncStatementNewByCompCodeAndEndDate(compCode, endDate)
							if err4 != nil {
								global.LOG.Error("goCanal 更新最新指标表,查询TQ_FIN_PRGINCSTATEMENTNEW 一般企业利润表(新准则产品表)信息出错:", zap.Any("err", err4))
							}

							if prgIncStsNews != nil && len(prgIncStsNews) > 0 {
								s := prgIncStsNews[0]
								bizInco := s.Bizinco
								if bizInco == "" {
									bizInco = "0.000000"
								}
								netProfit := s.Netprofit
								if netProfit == "" {
									netProfit = "0.000000"
								}
								im["BIZINCO"] = bizInco
								im["NETPROFIT"] = netProfit
							}

							//查询TQ_FIN_PRGINDICDATA 衍生财务指标(产品表)_V3表信息
							indicDatas, err5 := h.CDB.GetPrgIndicDataByCompCodeAndEndDate(compCode, endDate)
							if err5 != nil {
								global.LOG.Error("goCanal 更新最新指标表,查询TQ_FIN_PRGINDICDATA 衍生财务指标(产品表)_V3表 信息出错:", zap.Any("err", err5))
							}
							if indicDatas != nil && len(indicDatas) > 0 {
								i := indicDatas[0]

								sgpmargin := i.Sgpmargin
								if sgpmargin == "" {
									sgpmargin = "0.000000"
								}
								npcut := i.Npcut
								if npcut == "" {
									npcut = "0.000000"
								}
								im["SGPMARGIN"] = sgpmargin
								im["NPCUT"] = npcut

							}

							//最新指标
							affectedLi, err1 := h.TDB.InsertLatestIndicatorSingle(INSERT_LATEST_INDICATOR_SQL, im) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增最新指标表出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 新增最新指标表 成功:", zap.Int64("nums", affectedLi))
							}

							//记录操作日志
							dm2 := new(domain.DATA_MONITOR)
							dm2.Action = INSERT_ACTION
							dm2.BizDesc = "新增最新指标数据"
							dm2.SourceTable = "TQ_FIN_PRGINDICDATASUB"
							dm2.TargetTable = "LATEST_INDICATOR"
							r0json2, _ := json.Marshal(e.Rows[0])
							dm2.SourceDataJson = string(r0json2)   //新增的值
							dm2.ModifiedDataJson = string(r0json2) //新增后的值
							dm2.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm2.ErrInfo = err1.Error()
							}
							rows = append(rows, dm2)

						}
					}

					//插入操作日志
					if len(rows) > 0 {
						affDm, el := h.TDB.InsertDataMonitor(rows)
						if el != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", el))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}
				}

			}
			// 删除操作，主要更新值为空
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				// 只删除 合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_c3 {
					//最新指标
					compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal delete.获取symbol失败:", zap.Any("err", err))
						return err
					}

					//记录操作日志
					var rows []*domain.DATA_MONITOR

					zeroVal := "0.000000"
					updateMap := make(map[string]string)

					if symbols != nil {
						for _, symbol := range symbols {
							updateMap["SYMBOL"] = symbol.Symbol

							updateMap["PROFITRATIO"] = zeroVal //净利润率(%)

							//设置通用map key值
							ry := fmt.Sprintf("%v", deletedMap["REPORTYEAR"])
							updateMap["REPORTYEAR"] = ry //会计年度
							rdt := fmt.Sprintf("%v", deletedMap["REPORTDATETYPE"])
							updateMap["REPORTDATETYPE"] = rdt //报告期类型
							cpc := fmt.Sprintf("%v", deletedMap["COMPCODE"])
							updateMap["COMPCODE"] = cpc // 公司内码

							affected, err1 := h.TDB.UpdateKeyIndicator(updateMap) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal Delete Action 衍生财务指标副表(产品表)_V3 出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal Delete Action 衍生财务指标副表(产品表)_V3 成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = DELETE_ACTION
							dm.BizDesc = "删除财务主要指标数据"
							dm.SourceTable = "TQ_FIN_PRGINDICDATASUB"
							dm.TargetTable = "KEY_INDICATOR"
							dm.ModifiedDataJson = "" //删除后的值为空

							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json) //删除前的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err != nil {
								dm.ErrInfo = err.Error()
							}
							rows = append(rows, dm)

						}

						for _, symbol := range symbols {
							//设置symbol
							updateMap["SYMBOL"] = symbol.Symbol
							updateMap["COMPCODE"] = compCode
							updateMap["OPERINYOYB"] = zeroVal     //营业收入同比
							updateMap["NETINPNRPLYOYB"] = zeroVal //归属母公司股东净利润_扣除非经常性损益_同比

							affectedli, err1 := h.TDB.UpdateLatestIndicator(updateMap) // 更新主要指标
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 删除最新指标表出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 删除最新指标表 成功:", zap.Int64("nums", affectedli))
							}

							//记录操作日志
							dm2 := new(domain.DATA_MONITOR)
							dm2.Action = DELETE_ACTION
							dm2.BizDesc = "删除最新指标数据"
							dm2.SourceTable = "TQ_FIN_PRGINDICDATASUB"
							dm2.TargetTable = "LATEST_INDICATOR"
							dm2.ModifiedDataJson = "" //删除后的值为空

							r0json2, _ := json.Marshal(e.Rows[0])
							dm2.SourceDataJson = string(r0json2) //删除前的值
							dm2.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm2.ErrInfo = err1.Error()
							}
							rows = append(rows, dm2)
						}
					}

					//插入操作日志
					if len(rows) > 0 {
						affDm, el := h.TDB.InsertDataMonitor(rows)
						if el != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", el))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}
				}

			}

		}
		//公告信息
		if e.Table.Name == "TQ_SK_ANNOUNCEMT" || e.Table.Name == "tq_sk_announcemt" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//if "ANNTEXT" != e.Table.Columns[i].Name {
					//	colVal := fmt.Sprintf("%v", val)
					//	global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
					//}

				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				//一个compCode可能对应多个证券代码symbol
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				if symbols != nil {
					for _, symbol := range symbols {

						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						//fileLink获取
						announcementID := fmt.Sprintf("%v", insertedMap["ANNOUNCEMTID"])
						fileLink, errf := h.CDB.GetFileLinkByAnnouncemtId(announcementID)
						if errf != nil {
							global.LOG.Error("goCanal insert.获取公告 FileLink 失败:", zap.Any("err", errf))
							fileLink = ""
						}
						//设置 fileLink
						//insertedMap["FILELINK"] = filepath.ToSlash(fileLink)
						insertedMap["FILELINK"] = strings.ReplaceAll(fileLink, "\\", "/")

						//公告全文设置为空
						insertedMap["ANNTEXT"] = ""
						//公告日期类型转换
						declareDateStr := fmt.Sprintf("%v", insertedMap["DECLAREDATE"])
						insertedMap["DECLAREDATE"] = utils.DateParse(declareDateStr)

						// 具有文件地址才能新增
						if len(fileLink) > 0 {
							affected, errLog := h.TDB.InsertAnnouncementSingle(INSERT_ANNOUNCEMENT_SQL, insertedMap)
							if errLog != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增公告信息出错:", zap.Any("err", errLog))
							} else {
								global.LOG.Info("goCanal 新增公告信息成功:", zap.Int64("nums", affected))
							}

							//插入infoservice的Artices表
							/*
								article := &domain.Articles{
									SkId:        int(affected),
									ColumnLevel: global.ColumnLevel.Announcement,
									SortDate:    time.Now(),
								}
								a, ea := h.ADB.InsertArticlesSingle(article)
								if ea != nil {
									global.LOG.Error("goCanal 新增关联infoservice的Article公告信息出错:", zap.Any("err", ea))
								} else {
									global.LOG.Info("goCanal goCanal 新增关联infoservice的Article公告信息成功:", zap.Int64("nums", a))
								}
							*/

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增公告数据"
							dm.SourceTable = "TQ_SK_ANNOUNCEMT"
							dm.TargetTable = "ANNOUNCEMENT"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if errLog != nil {
								dm.ErrInfo = errLog.Error()
							}
							rows = append(rows, dm)

						}

					}
				}

				if len(rows) > 0 {
					//插入操作日志
					affDm, errl := h.TDB.InsertDataMonitor(rows)
					if errl != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", errl))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//if "ANNTEXT" != e.Table.Columns[i].Name { //避免打印超长内容
					//	colVal := fmt.Sprintf("%v", val)
					//	global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))
					//}

					updatedMap[e.Table.Columns[i].Name] = val
				}

				//fileLink获取
				announcementID := fmt.Sprintf("%v", updatedMap["ANNOUNCEMTID"])
				fileLink, errf := h.CDB.GetFileLinkByAnnouncemtId(announcementID)
				if errf != nil {
					global.LOG.Error("goCanal update.获取公告 FileLinke 失败:", zap.Any("err", errf))
					fileLink = ""
				}
				//设置 fileLink
				//updatedMap["FILELINK"] = filepath.ToSlash(fileLink)
				updatedMap["FILELINK"] = strings.ReplaceAll(fileLink, "\\", "/")
				updatedMap["ANNTEXT"] = "" //正文设置为空
				//公告日期类型转换
				declareDateStr := fmt.Sprintf("%v", updatedMap["DECLAREDATE"])
				updatedMap["DECLAREDATE"] = utils.DateParse(declareDateStr)

				affected, err := h.TDB.UpdateAnnouncement(UPDATE_ANNOUNCEMENT_SQL, updatedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更改公告信息出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更改公告信息成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新公告数据"
				dm.SourceTable = "TQ_SK_ANNOUNCEMT"
				dm.TargetTable = "ANNOUNCEMENT"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				//插入操作日志
				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//if "ANNTEXT" != e.Table.Columns[i].Name {
					//	colVal := fmt.Sprintf("%v", val)
					//	global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
					//}

				}
				affected, err := h.TDB.DeleteAnnouncement(DELETE_ANNOUNCEMENT_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除公告信息出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除公告信息成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除公告数据"
				dm.SourceTable = "TQ_SK_ANNOUNCEMT"
				dm.TargetTable = "ANNOUNCEMENT"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				//插入操作日志
				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
			}
		}
		//财务数据-主要指标-单季度
		if e.Table.Name == "TQ_FIN_PROQINDIC" || e.Table.Name == "tq_fin_proqindic" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				// 只更新 合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				endDate := fmt.Sprintf("%v", updatedMap["ENDDATE"])

				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {

					//查询基本每股收益
					pasqSubject, err := h.CDB.GetTqFinPrgPasqSubjects(compCode, endDate, reportType)
					if err != nil {
						global.LOG.Error("goCanal 财务数据-主要指标-单季度 查询基本每股收益出错:", zap.Any("err", err))
					}
					if pasqSubject != nil {
						basiceps := pasqSubject.Basiceps //基本每股收益
						if basiceps == "" {
							basiceps = "0.0000"
						}
						updatedMap["EPSBASIC"] = basiceps
					}

					affected, err := h.TDB.UpdateKeyIndicatorSq(UPDATE_KEY_INDICATOR_SQ_SQL, updatedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 更改财务数据-主要指标-单季度 出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 更改财务数据-主要指标-单季度 成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = UPDATE_ACTION
					dm.BizDesc = "更新财务单季度主要指标数据"
					dm.SourceTable = "TQ_FIN_PROQINDIC"
					dm.TargetTable = "KEY_INDICATOR_SQ"

					r1json, _ := json.Marshal(e.Rows[1])
					dm.ModifiedDataJson = string(r1json) //更改后的值

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //更改前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					//插入操作日志
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				// 只新增 合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
				endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])

				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							insertedMap["SYMBOL"] = symbol.Symbol
							insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

							if err != nil {
								global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
							}

							//查询基本每股收益
							pasqSubject, err0 := h.CDB.GetTqFinPrgPasqSubjects(compCode, endDate, reportType)
							if err0 != nil {
								global.LOG.Error("goCanal 财务数据-主要指标-单季度 查询基本每股收益出错:", zap.Any("err", err0))
							}
							if pasqSubject != nil {
								basiceps := pasqSubject.Basiceps //基本每股收益
								if basiceps == "" {
									basiceps = "0.0000"
								}
								insertedMap["EPSBASIC"] = basiceps
							}

							affected, err1 := h.TDB.InsertKeyIndicatorSqSingle(INSERT_KEY_INDICATOR_SQ_SQL, insertedMap)
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增财务数据-主要指标-单季度 出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 新增财务数据-主要指标-单季度 成功:", zap.Int64("nums", affected))
							}
						}
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = INSERT_ACTION
					dm.BizDesc = "新增财务单季度主要指标数据"
					dm.SourceTable = "TQ_FIN_PROQINDIC"
					dm.TargetTable = "KEY_INDICATOR_SQ"
					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json)   //新增的值
					dm.ModifiedDataJson = string(r0json) //新增后的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					//插入操作日志
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				// 只删除 合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])

				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					affected, err := h.TDB.DeleteKeyIndicatorSq(DELETE_KEY_INDICATOR_SQ_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 删除财务数据-主要指标-单季度 出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 删除财务数据-主要指标-单季度 成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除财务单季度主要指标数据"
					dm.SourceTable = "TQ_FIN_PROQINDIC"
					dm.TargetTable = "KEY_INDICATOR_SQ"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					//插入操作日志
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//财务数据-利润表-单季度
		if e.Table.Name == "TQ_FIN_PRGPASQSUBJECTS" || e.Table.Name == "tq_fin_prgpasqsubjects" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//只更新 合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {

					//设置营业务收支净额
					defVal := "0.000000"
					nnonopi := fmt.Sprintf("%v", updatedMap["NNONOPI"])
					if nnonopi == "<nil>" {
						nnonopi = defVal
					}
					updatedMap["NONBIZINCO"] = nnonopi // 营业外收支净额

					//财务利润单季度
					affected, err1 := h.TDB.UpdateIncomeStatementSq(UPDATE_INCOME_STATEMENT_SQ_SQL, updatedMap)
					if err1 != nil {
						//仅记录出错日志，不退出程序，
						log.Printf("goCanal 更改财务数据-利润表-单季度 出错：%v", err1.Error())
					} else {
						log.Printf("goCanal 更改财务数据-利润表-单季度 成功：%v", affected)
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = UPDATE_ACTION
					dm.BizDesc = "更新财务单季度利润数据"
					dm.SourceTable = "TQ_FIN_PRGPASQSUBJECTS"
					dm.TargetTable = "INCOME_STATEMENT_SQ"

					r1json, _ := json.Marshal(e.Rows[1])
					dm.ModifiedDataJson = string(r1json) //更改后的值

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //更改前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err1 != nil {
						dm.ErrInfo = err1.Error()
					}
					rows = append(rows, dm)

					//财务主要指标-单季度
					compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
					endDate := fmt.Sprintf("%v", updatedMap["ENDDATE"])

					//GetTqFinProQinDic(compCode string, endDate string, reportType string)(*domain.TQ_FIN_PROQINDIC,error)
					proQinDics, err0 := h.CDB.GetTqFinProQinDic(compCode, endDate, reportType)
					if err0 != nil {
						global.LOG.Error("goCanal 财务数据-主要指标-单季度 查询单季衍生指标（产品表）出错:", zap.Any("err", err0))
					}

					if proQinDics != nil {
						reportYear := proQinDics.Reportyear //会计年度
						updatedMap["REPORTYEAR"] = reportYear
						reportDateType := proQinDics.Reportdatetype //报告期类型
						updatedMap["REPORTDATETYPE"] = reportDateType
						opncfps := proQinDics.Opncfps //每股经营性现金流量
						updatedMap["OPNCFPS"] = opncfps
						sgpmargin := proQinDics.Sgpmargin //销售毛利率
						updatedMap["SNPMARGINCONMS"] = sgpmargin
						opprort := proQinDics.Opprort //营业利润率
						updatedMap["OPPRORT"] = opprort
						roediluted := proQinDics.Roediluted //摊薄净资产收益率
						updatedMap["ROEDILUTED"] = roediluted

						affIndic, err := h.TDB.UpdateKeyIndicatorSq(UPDATE_KEY_INDICATOR_SQ_SQL, updatedMap)
						if err != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更改财务数据-主要指标-单季度 出错:", zap.Any("err", err))
						} else {
							global.LOG.Info("goCanal 更改财务数据-主要指标-单季度 成功:", zap.Int64("nums", affIndic))
						}

						dm1 := new(domain.DATA_MONITOR)
						dm1.Action = UPDATE_ACTION
						dm1.BizDesc = "更新财务单季度主要指标数据"
						dm1.SourceTable = "TQ_FIN_PRGPASQSUBJECTS"
						dm1.TargetTable = "KEY_INDICATOR_SQ"

						r1json1, _ := json.Marshal(e.Rows[1])
						dm1.ModifiedDataJson = string(r1json1) //更改后的值

						r0json1, _ := json.Marshal(e.Rows[0])
						dm1.SourceDataJson = string(r0json1) //更改前的值
						dm1.ActionTime = utils.GetNowTimeStr()
						if err != nil {
							dm1.ErrInfo = err.Error()
						}
						rows = append(rows, dm1)

					}

					if len(rows) > 0 {
						//插入操作日志
						affDm, err2 := h.TDB.InsertDataMonitor(rows)
						if err2 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}

				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//只更新 合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							insertedMap["SYMBOL"] = symbol.Symbol
							insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

							//设置营业务收支净额
							defVal := "0.000000"
							nnonopi := fmt.Sprintf("%v", insertedMap["NNONOPI"])
							if nnonopi == "<nil>" {
								nnonopi = defVal
							}
							insertedMap["NONBIZINCO"] = nnonopi // 营业外收支净额

							affected, err1 := h.TDB.InsertIncomeStatementSqSingle(INSERT_INCOME_STATEMENT_SQ_SQL, insertedMap)
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增财务数据-利润-单季度 出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 新增财务数据-利润-单季度 成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增财财务单季度利润数据"
							dm.SourceTable = "TQ_FIN_PRGPASQSUBJECTS"
							dm.TargetTable = "INCOME_STATEMENT_SQ"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)

							//财务主要指标-单季度
							endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])

							//GetTqFinProQinDic(compCode string, endDate string, reportType string)(*domain.TQ_FIN_PROQINDIC,error)
							proQinDics, err0 := h.CDB.GetTqFinProQinDic(compCode, endDate, reportType)
							if err0 != nil {
								global.LOG.Error("goCanal 财务数据-主要指标-单季度 查询单季衍生指标（产品表）出错:", zap.Any("err", err0))
							}

							if proQinDics != nil {
								reportYear := proQinDics.Reportyear //会计年度
								insertedMap["REPORTYEAR"] = reportYear
								reportDateType := proQinDics.Reportdatetype //报告期类型
								insertedMap["REPORTDATETYPE"] = reportDateType
								opncfps := proQinDics.Opncfps //每股经营性现金流量
								insertedMap["OPNCFPS"] = opncfps
								sgpmargin := proQinDics.Sgpmargin //销售毛利率
								insertedMap["SNPMARGINCONMS"] = sgpmargin
								opprort := proQinDics.Opprort //营业利润率
								insertedMap["OPPRORT"] = opprort
								roediluted := proQinDics.Roediluted //摊薄净资产收益率
								insertedMap["ROEDILUTED"] = roediluted

								affIndic, err3 := h.TDB.InsertKeyIndicatorSqSingle(INSERT_KEY_INDICATOR_SQ_SQL, insertedMap)
								if err3 != nil {
									//仅记录出错日志，不退出程序，
									global.LOG.Error("goCanal 新增财务数据-主要指标-单季度 出错:", zap.Any("err", err3))
								} else {
									global.LOG.Info("goCanal 新增财务数据-主要指标-单季度 成功:", zap.Int64("nums", affIndic))
								}

								dm1 := new(domain.DATA_MONITOR)
								dm1.Action = INSERT_ACTION
								dm1.BizDesc = "新增财务单季度主要指标数据"
								dm1.SourceTable = "TQ_FIN_PRGPASQSUBJECTS"
								dm1.TargetTable = "KEY_INDICATOR_SQ"

								dm.SourceDataJson = string(r0json)   //新增的值
								dm.ModifiedDataJson = string(r0json) //新增后的值
								dm.ActionTime = utils.GetNowTimeStr()
								if err3 != nil {
									dm1.ErrInfo = err3.Error()
								}
								rows = append(rows, dm1)

							}

							if len(rows) > 0 {
								//插入操作日志
								affDm, err2 := h.TDB.InsertDataMonitor(rows)
								if err2 != nil {
									global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
								}
								global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
							}

						}
					}

				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				//只删除 合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					affected, err := h.TDB.DeleteIncomeStatementSq(DELETE_INCOME_STATEMENT_SQ_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 删除财务数据-利润-单季度 出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 删除财务数据-利润-单季度成功:", zap.Int64("nums", affected))
					}

					//记录操作日志
					var rows []*domain.DATA_MONITOR

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除财务单季度利润数据"
					dm.SourceTable = "TQ_FIN_PRGPASQSUBJECTS"
					dm.TargetTable = "INCOME_STATEMENT_SQ"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					//财务单季度-最新指标
					affected1, err := h.TDB.DeleteKeyIndicatorSq(DELETE_KEY_INDICATOR_SQ_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 删除财务数据-主要指标-单季度 出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 删除财务数据-主要指标-单季度 成功:", zap.Int64("nums", affected1))
					}

					dm1 := new(domain.DATA_MONITOR)
					dm1.Action = DELETE_ACTION
					dm1.BizDesc = "删除财务单季度主要指标数据"
					dm1.SourceTable = "TQ_FIN_PRGPASQSUBJECTS"
					dm1.TargetTable = "KEY_INDICATOR_SQ"
					dm1.ModifiedDataJson = "" //删除后的值为空

					r0json1, _ := json.Marshal(e.Rows[0])
					dm1.SourceDataJson = string(r0json1) //删除前的值
					dm1.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm1)

					//插入操作日志
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//财务数据-现金流-单季度
		if e.Table.Name == "TQ_FIN_PRGCFSQSUBJECTS" || e.Table.Name == "tq_fin_prgcfsqsubjects" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {
					//	global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//	colVal := fmt.Sprintf("%v", val)
					//	global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//只更新合并期末的
				reportType := fmt.Sprintf("%v", updatedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					affected, err := h.TDB.UpdateCashFLowSq(UPDATE_CASH_FLOW_SQ_SQL, updatedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 更改财务数据-现金流-单季度 出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 更改财务数据-现金流-单季度 成功:", zap.Any("err", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = UPDATE_ACTION
					dm.BizDesc = "更新财务单季度现金流数据"
					dm.SourceTable = "TQ_FIN_PRGCFSQSUBJECTS"
					dm.TargetTable = "CASH_FLOW_SQ"

					r1json, _ := json.Marshal(e.Rows[1])
					dm.ModifiedDataJson = string(r1json) //更改后的值

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //更改前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					//插入操作日志
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//只更新合并期末的
				reportType := fmt.Sprintf("%v", insertedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							insertedMap["SYMBOL"] = symbol.Symbol
							insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

							affected, err1 := h.TDB.InsertCashFlowSqSingle(INSERT_CASH_FLOW_SQ_SQL, insertedMap)
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增财务数据-现金流-单季度 出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 新增财务数据-现金流-单季度 成功:", zap.Any("err", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增财财务单季度现金流数据"
							dm.SourceTable = "TQ_FIN_PRGCFSQSUBJECTS"
							dm.TargetTable = "CASH_FLOW_SQ"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							rows = append(rows, dm)

							//插入操作日志
							affDm, err2 := h.TDB.InsertDataMonitor(rows)
							if err2 != nil {
								global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
							}
							global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

						}
					}

				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//只更新合并期末的
				reportType := fmt.Sprintf("%v", deletedMap["REPORTTYPE"])
				if reportType == REPORTTYPE_1 || reportType == REPORTTYPE_c3 {
					affected, err := h.TDB.DeleteCashFlowSq(DELETE_CASH_FLOW_SQ_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 删除财务数据-现金流-单季度 出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 删除财务数据-现金流-单季度 成功:", zap.Any("err", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除财务单季度现金流数据"
					dm.SourceTable = "TQ_FIN_PRGCFSQSUBJECTS"
					dm.TargetTable = "CASH_FLOW_SQ"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					//插入操作日志
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//股票历史日交易
		if e.Table.Name == "TQ_QT_SKDAILYPRICE" || e.Table.Name == "tq_qt_skdailyprice" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				//证券内码
				seCode := fmt.Sprintf("%v", insertedMap["SECODE"])
				/*
					symbol, err := h.CDB.GetSymbolByTrCode(seCode)
					if err != nil {
						global.LOG.Error(">>>>>>>>>>goCanal insert.根据SECODE 获取symbol失败:", zap.Any("err", err))
					}
					//设置symbol
					insertedMap["SYMBOL"] = symbol
				*/

				//设置exchange
				//	trCode := fmt.Sprintf("%v", insertedMap["TRCODE"])
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySeCode(seCode)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.根据Trcode 获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					//设置symbol
					insertedMap["SYMBOL"] = basicInfo.Symbol
					exchange := basicInfo.Exchange
					insertedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				//股票涨跌情况数据
				affected, err := h.TDB.InsertSkInfoChangeSingle(INSERT_SK_INFO_CHANGE_SQL, insertedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 新增股票历史日交易-涨跌情况失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 新增股票历史日交易-涨跌情况成功:", zap.Any("nums", affected))
				}
				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = INSERT_ACTION
				dm.BizDesc = "新增股票涨跌数据"
				dm.SourceTable = "TQ_QT_SKDAILYPRICE"
				dm.TargetTable = "SK_INFO_CHANGE"
				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json)   //新增的值
				dm.ModifiedDataJson = string(r0json) //新增后的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				//股东变化情况
				tqSKBasicInfo, err := h.CDB.GetTqSkBasicInfoBySeCode(seCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_QT_SKDAILYPRICE 根据证券内码，获取股票基本信息出错:", zap.String("seCode", seCode), zap.Any("err", err))
				}
				if tqSKBasicInfo != nil {
					symbolSK := tqSKBasicInfo.Symbol
					compCode := tqSKBasicInfo.Compcode //机构代码

					exchange := basicInfo.Exchange
					insertedMap["EXCHANGE"] = TransferExchane(exchange)

					insertedMap["SYMBOL"] = symbolSK   //证券编码
					insertedMap["COMPCODE"] = compCode //机构代码

					//收盘价
					tclose := fmt.Sprintf("%v", insertedMap["TCLOSE"])
					if tclose == "<nil>" {
						tclose = "0.0"
					}

					//交易日期
					tradeDate := fmt.Sprintf("%v", insertedMap["TRADEDATE"])

					insertedMap["ENDDATE"] = tradeDate //变动日期

					//GetTqSkShareHolderNumByCompCodeAndEndDate( compCode string,endDate string) ([]*domain.TQ_SK_SHAREHOLDERNUM, error)
					shareholders, err1 := h.CDB.GetTqSkShareHolderNumByCompCodeAndEndDate(compCode, tradeDate)
					if err1 != nil {
						global.LOG.Error("goCanal.TQ_QT_SKDAILYPRICE 根据机构编码和截止日期，获取股东户数统计出错:", zap.String("compCode", compCode), zap.String("tradeDate", tradeDate), zap.Any("err", err))
					}

					if shareholders != nil && len(shareholders) > 0 {
						sh := shareholders[0]

						totalShAmt := sh.Totalshamt //股东总户数
						insertedMap["TOTALSHAMT"] = totalShAmt
						totalShRto := sh.Totalshrto // 股东总户数交上期增减

						if totalShAmt != "0" && totalShAmt != "0.0" && totalShAmt != "null" && totalShAmt != "" {
							// 较上期变化： TOTALSHRTO/TOTALSHAMT
							totalShRtoDec, _ := decimal.NewFromString(totalShRto)
							totalShAmtDec, _ := decimal.NewFromString(totalShAmt)
							chgrtoDec := totalShRtoDec.Div(totalShAmtDec)
							totalShchgrto := chgrtoDec.String()

							insertedMap["TOTALSHCHGRTO"] = totalShchgrto //较上期变化
						}

						kavgsh := sh.Kavgsh // 人均流通股数
						if kavgsh == "" {
							kavgsh = "0"
						}
						insertedMap["KAVGSH"] = kavgsh

						//人均持股金额(元):公式：TCLOSE收盘价*KAVGSH户均持股数
						tcloseDec, _ := decimal.NewFromString(tclose)
						kavgshDec, _ := decimal.NewFromString(kavgsh)
						kavgholdamtDec := tcloseDec.Mul(kavgshDec)

						kavgholdamt := kavgholdamtDec.String()

						insertedMap["KAVGHOLDAMT"] = kavgholdamt

						affectedHC, err2 := h.TDB.InsertHolderChangeSingle(INSERT_HOLDER_CHANGE_SQL, insertedMap)
						if err2 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal.TQ_QT_SKDAILYPRICE 新增股东变化情况出错:", zap.Any("err", err2))
						} else {
							global.LOG.Info("goCanal.TQ_QT_SKDAILYPRICE 新增股东变化情况成功:", zap.Int64("nums", affectedHC))
						}

						dm1 := new(domain.DATA_MONITOR)
						dm1.Action = INSERT_ACTION
						dm1.BizDesc = "新增股东变动情况"
						dm1.SourceTable = "TQ_QT_SKDAILYPRICE"
						dm1.TargetTable = "HOLDER_CHANGE"
						r0json1, _ := json.Marshal(e.Rows[0])
						dm1.SourceDataJson = string(r0json1)   //新增的值
						dm1.ModifiedDataJson = string(r0json1) //新增后的值
						dm1.ActionTime = utils.GetNowTimeStr()
						if err2 != nil {
							dm1.ErrInfo = err2.Error()
						}
						rows = append(rows, dm1)

					}

				}

				if len(rows) > 0 {
					//插入操作日志
					affDm, errL := h.TDB.InsertDataMonitor(rows)
					if errL != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", errL))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}
				//证券内码
				seCode := fmt.Sprintf("%v", updatedMap["SECODE"])

				/*
					symbol, err := h.CDB.GetSymbolByTrCode(seCode)
					//设置symbol
					updatedMap["SYMBOL"] = symbol
					if err != nil {
						global.LOG.Error(">>>>>>>>>>goCanal update.根据Trcode 获取symbol失败:", zap.Any("err", err))
					}
				*/

				basicInfo, err := h.CDB.GetTqSkBasicInfoBySeCode(seCode)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.根据Trcode 获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					updatedMap["SYMBOL"] = basicInfo.Symbol
					exchange := basicInfo.Exchange
					updatedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				affected, err := h.TDB.UpdateSkInfoChange(UPDATE_SK_INFO_CHANGE_SQL, updatedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更改股票历史日交易-涨跌情况失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更改股票历史日交易-涨跌情况成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新股票涨跌数据"
				dm.SourceTable = "TQ_QT_SKDAILYPRICE"
				dm.TargetTable = "SK_INFO_CHANGE"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				//股东变化情况
				tqSKBasicInfo, err := h.CDB.GetTqSkBasicInfoBySeCode(seCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_QT_SKDAILYPRICE 根据证券内码，获取股票基本信息出错:", zap.String("seCode", seCode), zap.Any("err", err))
				}
				if tqSKBasicInfo != nil {
					symbolSK := tqSKBasicInfo.Symbol
					compCode := tqSKBasicInfo.Compcode //机构代码

					updatedMap["SYMBOL"] = symbolSK   //证券编码
					updatedMap["COMPCODE"] = compCode //机构代码

					//收盘价
					tclose := fmt.Sprintf("%v", updatedMap["TCLOSE"])
					if tclose == "<nil>" {
						tclose = "0.0"
					}
					//交易日期
					tradeDate := fmt.Sprintf("%v", updatedMap["TRADEDATE"])

					updatedMap["ENDDATE"] = tradeDate //变动日期

					//GetTqSkShareHolderNumByCompCodeAndEndDate( compCode string,endDate string) ([]*domain.TQ_SK_SHAREHOLDERNUM, error)
					shareholders, err1 := h.CDB.GetTqSkShareHolderNumByCompCodeAndEndDate(compCode, tradeDate)
					if err1 != nil {
						global.LOG.Error("goCanal.TQ_QT_SKDAILYPRICE 根据机构编码和截止日期，获取股东户数统计出错:", zap.String("compCode", compCode), zap.String("tradeDate", tradeDate), zap.Any("err", err))

					}

					if shareholders != nil && len(shareholders) > 0 {
						sh := shareholders[0]

						totalShAmt := sh.Totalshamt //股东总户数
						updatedMap["TOTALSHAMT"] = totalShAmt
						totalShRto := sh.Totalshrto // 股东总户数交上期增减

						if totalShAmt != "0" && totalShAmt != "0.0" && totalShAmt != "null" && totalShAmt != "" {
							// 较上期变化： TOTALSHRTO/TOTALSHAMT
							totalShRtoDec, _ := decimal.NewFromString(totalShRto)
							totalShAmtDec, _ := decimal.NewFromString(totalShAmt)
							chgrtoDec := totalShRtoDec.Div(totalShAmtDec)
							totalShchgrto := chgrtoDec.String()

							updatedMap["TOTALSHCHGRTO"] = totalShchgrto //较上期变化
						}

						kavgsh := sh.Kavgsh // 人均流通股数
						updatedMap["KAVGSH"] = kavgsh

						//人均持股金额(元):公式：TCLOSE收盘价*KAVGSH户均持股数
						tcloseDec, _ := decimal.NewFromString(tclose)
						kavgshDec, _ := decimal.NewFromString(kavgsh)
						kavgholdamtDec := tcloseDec.Mul(kavgshDec)

						kavgholdamt := kavgholdamtDec.String()

						updatedMap["KAVGHOLDAMT"] = kavgholdamt

						affectedHC, err2 := h.TDB.UpdateHolderChange(UPDATE_HOLDER_CHANGE_SQL, updatedMap)
						if err2 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal.TQ_QT_SKDAILYPRICE 更新股东变化情况出错:", zap.Any("err", err2))
						} else {
							global.LOG.Info("goCanal.TQ_QT_SKDAILYPRICE 更新股东变化情况成功:", zap.Int64("nums", affectedHC))
						}

						dm1 := new(domain.DATA_MONITOR)
						dm1.Action = UPDATE_ACTION
						dm1.BizDesc = "更新股东变动情况"
						dm1.SourceTable = "TQ_QT_SKDAILYPRICE"
						dm1.TargetTable = "HOLDER_CHANGE"

						r1json1, _ := json.Marshal(e.Rows[1])
						dm1.ModifiedDataJson = string(r1json1) //更改后的值

						r0json1, _ := json.Marshal(e.Rows[0])
						dm1.SourceDataJson = string(r0json1) //更改前的值
						dm1.ActionTime = utils.GetNowTimeStr()
						if err2 != nil {
							dm1.ErrInfo = err2.Error()
						}
						rows = append(rows, dm1)

					}

				}

				if len(rows) > 0 {
					//插入操作日志
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
					deletedMap[e.Table.Columns[i].Name] = val
				}
				//证券内码
				seCode := fmt.Sprintf("%v", deletedMap["SECODE"])
				/*
					symbol, err := h.CDB.GetSymbolByTrCode(seCode)
					//设置symbol
					deletedMap["SYMBOL"] = symbol
					if err != nil {
						global.LOG.Error(">>>>>>>>>>goCanal delete.根据Trcode 获取symbol失败:", zap.Any("err", err))
					}
				*/
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySeCode(seCode)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal delete.根据Trcode 获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					deletedMap["SYMBOL"] = basicInfo.Symbol
					exchange := basicInfo.Exchange
					deletedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				affected, err := h.TDB.DeleteSkInfoChange(DELETE_SK_INFO_CHANGE_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除股票历史日交易-涨跌情况出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除股票历史日交易-涨跌情况成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除股票涨跌数据"
				dm.SourceTable = "TQ_QT_SKDAILYPRICE"
				dm.TargetTable = "SK_INFO_CHANGE"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				//股东变化情况
				tqSKBasicInfo, err := h.CDB.GetTqSkBasicInfoBySeCode(seCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_QT_SKDAILYPRICE 根据证券内码，获取股票基本信息出错:", zap.String("seCode", seCode), zap.Any("err", err))
				}
				if tqSKBasicInfo != nil {
					compCode := tqSKBasicInfo.Compcode //机构代码
					deletedMap["COMPCODE"] = compCode  //机构代码

					affectedHC, err2 := h.TDB.DeleteHolderChange(DELETE_CASH_FLOW_SQ_SQL, deletedMap)
					if err2 != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal.TQ_QT_SKDAILYPRICE 删除股东变化情况出错:", zap.Any("err", err2))
					} else {
						global.LOG.Info("goCanal.TQ_QT_SKDAILYPRICE 删除股东变化情况成功:", zap.Int64("nums", affectedHC))
					}

					dm1 := new(domain.DATA_MONITOR)
					dm1.Action = DELETE_ACTION
					dm1.BizDesc = "删除股东变动情况"
					dm1.SourceTable = "TQ_QT_SKDAILYPRICE"
					dm1.TargetTable = "HOLDER_CHANGE"
					dm1.ModifiedDataJson = "" //删除后的值为空

					r0json1, _ := json.Marshal(e.Rows[0])
					dm1.SourceDataJson = string(r0json1) //删除前的值
					dm1.ActionTime = utils.GetNowTimeStr()
					if err2 != nil {
						dm1.ErrInfo = err2.Error()
					}
					rows = append(rows, dm1)

				}

				if len(rows) > 0 {
					//插入操作日志
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}

		}
		// 快讯新闻基本信息表
		if e.Table.Name == "T_QNEWS_BASIC" || e.Table.Name == "t_qnews_basic" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				sourceKey := fmt.Sprintf("%v", insertedMap["SOURCEKEY"])
				symbol, err := h.CDB.GetSymbolBySourceKey(sourceKey)
				//设置symbol
				insertedMap["SYMBOL"] = symbol
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.根据SourceKey 获取symbol失败:", zap.Any("err", err))
				}

				//设置exchange
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.根据symbol 获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					exchange := basicInfo.Exchange
					insertedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				publishTimeMet := fmt.Sprintf("%v", insertedMap["PUBLISHTIME_MET"])
				if publishTimeMet != "" && publishTimeMet != "null" && publishTimeMet != "<nil>" {
					insertedMap["PUBLISHTIME"] = publishTimeMet //精确到时分秒
				}
				insertedMap["SORTTIME"] = time.Now() //排序时间

				//构建ID为sourceKey
				insertedMap["ID"] = sourceKey

				affected, err := h.TDB.InsertNewsSingle(INSERT_NEWS_SQL, insertedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 新增快讯证券新闻数据失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 新增快讯证券新闻数据成功:", zap.Int64("nums", affected))
				}

				//插入infoservice的Artices表
				/*
					article := &domain.Articles{
						SkId:        int(affected),
						ColumnLevel: global.ColumnLevel.News,
						SortDate:    time.Now(),
					}
					a, ea := h.ADB.InsertArticlesSingle(article)
					if ea != nil {
						global.LOG.Error("goCanal 新增关联infoservice的Article资讯信息出错:", zap.Any("err", ea))
					} else {
						global.LOG.Info("goCanal goCanal 新增关联infoservice的Article资讯信息成功:", zap.Int64("nums", a))
					}
				*/

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = INSERT_ACTION
				dm.BizDesc = "新增快讯数据"
				dm.SourceTable = "T_QNEWS_BASIC"
				dm.TargetTable = "NEWS"
				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json)   //新增的值
				dm.ModifiedDataJson = string(r0json) //新增后的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})

				for i, val := range e.Rows[1] {
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				sourceKey := fmt.Sprintf("%v", updatedMap["SOURCEKEY"])
				symbol, err := h.CDB.GetSymbolBySourceKey(sourceKey)
				//设置symbol
				updatedMap["SYMBOL"] = symbol
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.根据SourceKey 获取symbol失败:", zap.Any("err", err))
				}

				//设置exchange
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.根据symbol 获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					exchange := basicInfo.Exchange
					updatedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				publishTimeMet := fmt.Sprintf("%v", updatedMap["PUBLISHTIME_MET"])
				if publishTimeMet != "" && publishTimeMet != "null" && publishTimeMet != "<nil>" {
					updatedMap["PUBLISHTIME"] = publishTimeMet //精确到时分秒
				}

				affected, err := h.TDB.UpdateNews(UPDATE_NEWS_SQL, updatedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更新快讯证券新闻数据失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更新快讯证券新闻数据成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新快讯数据"
				dm.SourceTable = "T_QNEWS_BASIC"
				dm.TargetTable = "NEWS"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

					deletedMap[e.Table.Columns[i].Name] = val
				}

				sourceKey := fmt.Sprintf("%v", deletedMap["SOURCEKEY"])
				symbol, err := h.CDB.GetSymbolBySourceKey(sourceKey)
				//设置symbol
				deletedMap["SYMBOL"] = symbol
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal delete.根据SourceKey 获取symbol失败:", zap.Any("err", err))
				}

				//设置exchange
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal delete.根据symbol 获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					exchange := basicInfo.Exchange
					deletedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				affected, err := h.TDB.DeleteNews(DELETE_NEWS_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除快讯证券新闻数据失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除快讯证券新闻数据成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除快讯数据"
				dm.SourceTable = "T_QNEWS_BASIC"
				dm.TargetTable = "NEWS"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		// 公司大事提醒
		if e.Table.Name == "TQ_SK_IMPORTEVENT" || e.Table.Name == "tq_sk_importevent" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				symbol := fmt.Sprintf("%v", insertedMap["SYMBOL"])
				//设置exchange
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.根据symbol 获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					exchange := basicInfo.Exchange
					insertedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				affected, err := h.TDB.InsertEventRemindSingle(INSERT_EVENT_REMIND_SQL, insertedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 新增公司大事提醒出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 新增公司大事提醒成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = INSERT_ACTION
				dm.BizDesc = "新增公司大事提醒"
				dm.SourceTable = "TQ_SK_IMPORTEVENT"
				dm.TargetTable = "EVENT_REMIND"
				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json)   //新增的值
				dm.ModifiedDataJson = string(r0json) //新增后的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				affected, err := h.TDB.UpdateEventRemind(UPDATE_EVENT_REMIND_SQL, updatedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更新公司大事提醒出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更新公司大事提醒成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新公司大事提醒"
				dm.SourceTable = "TQ_SK_IMPORTEVENT"
				dm.TargetTable = "EVENT_REMIND"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}
				affected, err := h.TDB.DeleteEventRemind(DELETE_EVENT_REMIND_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除公司大事提醒出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除公司大事提醒成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除公司大事提醒"
				dm.SourceTable = "TQ_SK_IMPORTEVENT"
				dm.TargetTable = "EVENT_REMIND"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		//分红派送
		if e.Table.Name == "TQ_SK_BONUS" || e.Table.Name == "tq_sk_bonus" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)
						//分红配送
						affected, err1 := h.TDB.InsertDividendSingle(INSERT_DIVIDEND_SQL, insertedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增分红派送出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 新增分红派送成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = INSERT_ACTION
						dm.BizDesc = "新增分红派送"
						dm.SourceTable = "TQ_SK_BONUS"
						dm.TargetTable = "DIVIDEND"
						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json)   //新增的值
						dm.ModifiedDataJson = string(r0json) //新增后的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

						//分红融资
						bfAffected, err2 := h.TDB.InsertBonusFinancingSingle(INSERT_BONUS_FINANCING_SQL, insertedMap)
						if err2 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增分红融资出错:", zap.Any("err", err2))
						} else {
							global.LOG.Info("goCanal 新增分红融资成功:", zap.Int64("nums", bfAffected))
						}

						dm1 := new(domain.DATA_MONITOR)
						dm1.Action = INSERT_ACTION
						dm1.BizDesc = "新增分红融资"
						dm1.SourceTable = "TQ_SK_BONUS"
						dm1.TargetTable = "BONUS_FINANCING"
						r0json1, _ := json.Marshal(e.Rows[0])
						dm1.SourceDataJson = string(r0json1)   //新增的值
						dm1.ModifiedDataJson = string(r0json1) //新增后的值
						dm1.ActionTime = utils.GetNowTimeStr()
						if err2 != nil {
							dm1.ErrInfo = err2.Error()
						}
						rows = append(rows, dm1)

					}
				}

				if len(rows) > 0 {
					affDm, err3 := h.TDB.InsertDataMonitor(rows)
					if err3 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//证券内码
				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					log.Printf(">>>>>>>>>>goCanal insert.根据Trcode 获取symbol失败:%v", err)
					return err
				}

				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						updatedMap["SYMBOL"] = symbol.Symbol

						//分红配送
						affected, err1 := h.TDB.UpdateDividend(UPDATE_DIVIDEND_SQL, updatedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更新分红派送情况失败:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 更新分红派送情况成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = UPDATE_ACTION
						dm.BizDesc = "更新分红派送"
						dm.SourceTable = "TQ_SK_BONUS"
						dm.TargetTable = "DIVIDEND"

						r1json, _ := json.Marshal(e.Rows[1])
						dm.ModifiedDataJson = string(r1json) //更改后的值

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //更改前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

						//分红融资
						bfAffected, err2 := h.TDB.UpdateBonusFinancing(UPDATE_BONUS_FINANCING_SQL, updatedMap)
						if err2 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更新分红融资失败:", zap.Any("err", err2))
						} else {
							global.LOG.Info("goCanal 更新分红融资成功:", zap.Int64("nums", bfAffected))
						}

						dm1 := new(domain.DATA_MONITOR)
						dm1.Action = UPDATE_ACTION
						dm1.BizDesc = "更新分红融资"
						dm1.SourceTable = "TQ_SK_BONUS"
						dm1.TargetTable = "BONUS_FINANCING"

						r1json1, _ := json.Marshal(e.Rows[1])
						dm1.ModifiedDataJson = string(r1json1) //更改后的值

						r0json1, _ := json.Marshal(e.Rows[0])
						dm1.SourceDataJson = string(r0json1) //更改前的值
						dm1.ActionTime = utils.GetNowTimeStr()
						if err2 != nil {
							dm1.ErrInfo = err2.Error()
						}
						rows = append(rows, dm1)

					}
				}

				if len(rows) > 0 {
					affDm, err3 := h.TDB.InsertDataMonitor(rows)
					if err3 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

					deletedMap[e.Table.Columns[i].Name] = val
				}

				//分红配送
				affected, err := h.TDB.DeleteDividend(DELETE_DIVIDEND_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除分红派送出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除分红派送成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除分红派送"
				dm.SourceTable = "TQ_SK_BONUS"
				dm.TargetTable = "DIVIDEND"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				//分红融资
				bfAffected, err := h.TDB.DeleteBonusFinancing(DELETE_BONUS_FINANCING_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除分红融资出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除分红融资成功:", zap.Int64("nums", bfAffected))
				}

				dm1 := new(domain.DATA_MONITOR)
				dm1.Action = DELETE_ACTION
				dm1.BizDesc = "删除分红融资"
				dm1.SourceTable = "TQ_SK_BONUS"
				dm1.TargetTable = "BONUS_FINANCING"
				dm1.ModifiedDataJson = "" //删除后的值为空

				r0json1, _ := json.Marshal(e.Rows[0])
				dm1.SourceDataJson = string(r0json1) //删除前的值
				dm1.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm1.ErrInfo = err.Error()
				}
				rows = append(rows, dm1)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
			}
		}
		//融资融券交易明细
		if e.Table.Name == "TQ_SK_FINMRGNINFO" || e.Table.Name == "tq_sk_finmrgninfo" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				symbol := fmt.Sprintf("%v", insertedMap["SYMBOL"])
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				//设置symbol
				insertedMap["COMPCODE"] = compCode
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.获取compCode失败:", zap.Any("err", err))
				}

				affected, err := h.TDB.InsertMarginSingle(INSERT_MARGIN_SQL, insertedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 新增资料融资融券出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 新增资料融资融券 成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = INSERT_ACTION
				dm.BizDesc = "新增融资融券"
				dm.SourceTable = "TQ_SK_FINMRGNINFO"
				dm.TargetTable = "MARGIN"
				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json)   //新增的值
				dm.ModifiedDataJson = string(r0json) //新增后的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				symbol := fmt.Sprintf("%v", updatedMap["SYMBOL"])
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				//设置symbol
				updatedMap["COMPCODE"] = compCode
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.获取compCode失败:", zap.Any("err", err))
				}

				affected, err := h.TDB.UpdateMargin(UPDATE_MARGIN_SQL, updatedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更改资料融资融券失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更新资料融资融券成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新融资融券"
				dm.SourceTable = "TQ_SK_FINMRGNINFO"
				dm.TargetTable = "MARGIN"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

					deletedMap[e.Table.Columns[i].Name] = val
				}

				affected, err := h.TDB.DeleteMargin(DELETE_MARGIN_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除资料融资融券失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除资料融资融券成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除融资融券"
				dm.SourceTable = "TQ_SK_FINMRGNINFO"
				dm.TargetTable = "MARGIN"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		//盈利预测-上市公司业绩预测
		/*
			if e.Table.Name == "TQ_SK_EXPTPERFORMANCE" || e.Table.Name == "tq_sk_exptperformance" {
				if e.Action == canal.InsertAction {
					insertedMap := make(map[string]interface{})
					global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName",e.Table.Name))
					for i, val := range e.Rows[0] {
						insertedMap[e.Table.Columns[i].Name] = val
						//	news.ID = val.(int64)
						//if e.Table.Columns[i].Name == "ID" {
						//}

						//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
						//colVal := fmt.Sprintf("%v", val)
						//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
					}

					compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					}

					// 记录操作日志
					var rows []*domain.DATA_MONITOR

					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						affected, err1 := h.TDB.InsertProfitForecastSingle(INSERT_PROFIT_FORECAST_SQL, insertedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增盈利预测出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 新增盈利预测成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = INSERT_ACTION
						dm.BizDesc = "新增公司业绩盈利预测"
						dm.SourceTable = "TQ_SK_EXPTPERFORMANCE"
						dm.TargetTable = "PROFIT_FORECAST"
						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json)   //新增的值
						dm.ModifiedDataJson = string(r0json) //新增后的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

						affDm, err2 := h.TDB.InsertDataMonitor(rows)
						if err2 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

					}

				}
				if e.Action == canal.UpdateAction {
					updatedMap := make(map[string]interface{})
					global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
					for i, val := range e.Rows[1] {

						//	global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
						//	colVal := fmt.Sprintf("%v", val)
						//	global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

						updatedMap[e.Table.Columns[i].Name] = val
					}

					compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
					symbols, err := h.CDB.GetSymbolByCompCode(compCode)
					if err != nil {
						global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					}

					// 记录操作日志
					var rows []*domain.DATA_MONITOR

					for _, symbol := range symbols {
						//设置symbol
						updatedMap["SYMBOL"] = symbol.Symbol

						affected, err1 := h.TDB.UpdateProfitForecast(UPDATE_PROFIT_FORECAST_SQL, updatedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更新盈利预测出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 更新盈利预测成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = UPDATE_ACTION
						dm.BizDesc = "更新公司业绩盈利预测"
						dm.SourceTable = "TQ_SK_EXPTPERFORMANCE"
						dm.TargetTable = "PROFIT_FORECAST"

						r1json, _ := json.Marshal(e.Rows[1])
						dm.ModifiedDataJson = string(r1json) //更改后的值

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //更改前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

						affDm, err2 := h.TDB.InsertDataMonitor(rows)
						if err2 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

					}

				}
				if e.Action == canal.DeleteAction {
					deletedMap := make(map[string]interface{})
					global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
					for i, val := range e.Rows[0] {

						//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
						//colVal := fmt.Sprintf("%v", val)
						//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

						deletedMap[e.Table.Columns[i].Name] = val
					}

					affected, err := h.TDB.DeleteProfitForecast(DELETE_PROFIT_FORECAST_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 删除盈利预测出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 删除盈利预测成功:", zap.Int64("nums", affected))
					}

					//记录操作日志
					var rows []*domain.DATA_MONITOR

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除公司业绩盈利预测"
					dm.SourceTable = "TQ_SK_EXPTPERFORMANCE"
					dm.TargetTable = "PROFIT_FORECAST"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

				}
			}
		*/
		//盈利预测-个股一致预期-预测上市公司未来三年的业绩状况及预期变化信息
		if e.Table.Name == "TQ_EXPT_SKSTATN" || e.Table.Name == "tq_expt_skstatn" {
			//取最新的publishDate数据插入
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
				}
				symbol := fmt.Sprintf("%v", insertedMap["SYMBOL"]) //证券代码
				basicInfo, errInf := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if errInf != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.根据symbol获取股票基本信息:", zap.Any("err", errInf))
				}
				//市场代码
				exchange := ""
				if basicInfo != nil {
					exchange = TransferExchane(basicInfo.Exchange)

					publishDate := fmt.Sprintf("%v", insertedMap["PUBLISHDATE"]) //研报日期
					if publishDate == "<nil>" {
						publishDate = ""
					}
					//根据PUBLISHDATE+SYMBOL取得该证券最新研报日期的数据
					profitForecast, err := h.TDB.GetLatestPublishDateProfitForecast(symbol)
					if err != nil {
						global.LOG.Error(">>>>>>>>>>goCanal 根据symbol获取最新研报日期的盈利预测数据失败:", zap.Any("err", err))
					}

					// 记录操作日志
					var mrows []*domain.DATA_MONITOR

					global.LOG.Info("盈利预测新增研报日期信息:", zap.String("symbol", symbol), zap.String("publishDate", publishDate))
					//说明已经有该symbol的盈利预测数据,则需要更新成最新的数据
					if profitForecast != nil && len(profitForecast.Symbol) > 0 {
						global.LOG.Info("盈利预测已存最新研报日期信息:", zap.String("symbol", symbol), zap.String("publishDate", profitForecast.Publishdate))
						var rows []*domain.PROFIT_FORECAST
						// 来了一条该symbol的新日期的盈利预测数据
						if strings.Compare(publishDate, profitForecast.Publishdate) == 1 {
							defVal := "0.0000"

							//一致预测一期
							r1 := new(domain.PROFIT_FORECAST)
							r1.Symbol = symbol
							r1.Compcode = basicInfo.Compcode
							r1.Exchange = exchange //市场代码

							tendDate := fmt.Sprintf("%v", insertedMap["TENDDATE"]) //TENDDATE 预测截止日期（一期）
							if tendDate == "<nil>" {
								tendDate = ""
							}
							//截取预测年度
							if len(tendDate) >= 4 {
								tendDate = tendDate[:4]
							}

							if len(tendDate) > 0 {
								r1.Exptyear = tendDate       //年度
								r1.Publishdate = publishDate //研报日期

								tmBizIncome := fmt.Sprintf("%v", insertedMap["TMBIZINCOME"]) //TMBIZINCOME 一致预期营业收入（一期）
								if tmBizIncome == "<nil>" {
									tmBizIncome = defVal
								}
								r1.Opermincome = tmBizIncome //一致预期营业收入（一期）

								tnetProfit := fmt.Sprintf("%v", insertedMap["TNETPROFIT"]) //TNETPROFIT 一致预期净利润（一期）
								if tnetProfit == "<nil>" {
									tnetProfit = defVal
								}
								r1.Retamaxprofits = tnetProfit //一致预期净利润（一期）

								teps := fmt.Sprintf("%v", insertedMap["TEPS"]) //TEPS 一致预期每股收益(一期）
								if teps == "<nil>" {
									teps = defVal
								}
								r1.Epsmaxfore = teps //一致预期每股收益(一期）

								rows = append(rows, r1)

							}

							//一致预测二期
							r2 := new(domain.PROFIT_FORECAST)
							r2.Symbol = symbol
							r2.Compcode = basicInfo.Compcode
							r2.Exchange = exchange //市场代码

							nendDate := fmt.Sprintf("%v", insertedMap["NENDDATE"]) //NENDDATE 预测截止日期（二期）
							if nendDate == "<nil>" {
								nendDate = ""
							}

							if len(nendDate) >= 4 {
								nendDate = nendDate[:4]
							}

							if len(nendDate) > 0 {
								r2.Exptyear = nendDate       //年度
								r2.Publishdate = publishDate //研报日期

								nmBizIncome := fmt.Sprintf("%v", insertedMap["NMBIZINCOME"]) //NMBIZINCOME 一致预期营业收入（二期）
								if nmBizIncome == "<nil>" {
									nmBizIncome = defVal
								}
								r2.Opermincome = nmBizIncome //一致预期营业收入（二期）

								nnetProfit := fmt.Sprintf("%v", insertedMap["NNETPROFIT"]) //NNETPROFIT 一致预期净利润（二期）
								if nnetProfit == "<nil>" {
									nnetProfit = defVal
								}
								r2.Retamaxprofits = nnetProfit //一致预期净利润（二期）

								neps := fmt.Sprintf("%v", insertedMap["NEPS"]) //NEPS 一致预期每股收益（二期）
								if neps == "<nil>" {
									neps = defVal
								}
								r2.Epsmaxfore = neps //一致预期每股收益（二期）

								rows = append(rows, r2)
							}

							//一致预测三期
							r3 := new(domain.PROFIT_FORECAST)
							r3.Symbol = symbol
							r3.Compcode = basicInfo.Compcode
							r3.Exchange = exchange //市场代码

							yanendDate := fmt.Sprintf("%v", insertedMap["YANENDDATE"]) //YANENDDATE 预测截止日期（三期）
							if yanendDate == "<nil>" {
								yanendDate = ""
							}

							if len(yanendDate) >= 4 {
								yanendDate = yanendDate[:4]
							}

							if len(yanendDate) > 0 {

								r3.Exptyear = yanendDate     //年度
								r3.Publishdate = publishDate //研报日期

								yanmBizIncome := fmt.Sprintf("%v", insertedMap["YANMBIZINCOME"]) //YANMBIZINCOME 一致预期营业收入(三期)
								if yanmBizIncome == "<nil>" {
									yanmBizIncome = defVal
								}

								r3.Opermincome = yanmBizIncome //一致预期营业收入(三期)

								yannetProfit := fmt.Sprintf("%v", insertedMap["YANNETPROFIT"]) //YANNETPROFIT 一致预期净利润（三期）
								if yannetProfit == "<nil>" {
									yannetProfit = defVal
								}
								r3.Retamaxprofits = yannetProfit //一致预期净利润（三期）

								yaneps := fmt.Sprintf("%v", insertedMap["YANEPS"]) //YANEPS 一致预期每股收益（三期）
								if yaneps == "<nil>" {
									yaneps = defVal
								}
								r3.Epsmaxfore = yaneps //一致预期每股收益（三期）

								rows = append(rows, r3)
							}

							for _, r := range rows {
								um := make(map[string]string)

								um["SYMBOL"] = r.Symbol
								um["COMPCODE"] = r.Compcode
								um["PUBLISHDATE"] = r.Publishdate
								um["EXPTYEAR"] = r.Exptyear
								um["OPERMINCOME"] = r.Opermincome
								um["RETAMAXPROFITS"] = r.Retamaxprofits
								um["EPSMAXFORE"] = r.Epsmaxfore

								affected, err1 := h.TDB.UpdateProfitForecastNew(UPDATE_PROFIT_FORECAST_SQL_NEW, um)
								if err1 != nil {
									//仅记录出错日志，不退出程序，
									global.LOG.Error("goCanal 新增->更新盈利预测出错:", zap.Any("err", err1))
								} else {
									global.LOG.Info("goCanal 新增->更新盈利预测成功:", zap.Int64("nums", affected))
								}

								dm := new(domain.DATA_MONITOR)
								dm.Action = INSERT_ACTION
								dm.BizDesc = "新增->更新-公司业绩盈利预测"
								dm.SourceTable = "TQ_EXPT_SKSTATN"
								dm.TargetTable = "PROFIT_FORECAST"
								r0json, _ := json.Marshal(e.Rows[0])
								dm.SourceDataJson = string(r0json)   //新增的值
								dm.ModifiedDataJson = string(r0json) //新增后的值
								dm.ActionTime = utils.GetNowTimeStr()
								if err1 != nil {
									dm.ErrInfo = err1.Error()
								}
								mrows = append(mrows, dm)
							}

							if len(mrows) > 0 {
								affDm, err2 := h.TDB.InsertDataMonitor(mrows)
								if err2 != nil {
									global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
								}
								global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
							}

						}
					} else {
						//如果是没有则新增
						var rows []*domain.PROFIT_FORECAST
						defVal := "0.0000"
						//一致预测一期
						r1 := new(domain.PROFIT_FORECAST)
						r1.Symbol = symbol
						r1.Compcode = basicInfo.Compcode
						r1.Exchange = exchange //市场代码

						tendDate := fmt.Sprintf("%v", insertedMap["TENDDATE"]) //TENDDATE 预测截止日期（一期）
						if tendDate == "<nil>" {
							tendDate = ""
						}
						//截取预测年度
						if len(tendDate) >= 4 {
							tendDate = tendDate[:4]
						}

						if len(tendDate) > 0 {
							r1.Exptyear = tendDate       //年度
							r1.Publishdate = publishDate //研报日期

							tmBizIncome := fmt.Sprintf("%v", insertedMap["TMBIZINCOME"]) //TMBIZINCOME 一致预期营业收入（一期）
							if tmBizIncome == "<nil>" {
								tmBizIncome = defVal
							}
							r1.Opermincome = tmBizIncome //一致预期营业收入（一期）

							tnetProfit := fmt.Sprintf("%v", insertedMap["TNETPROFIT"]) //TNETPROFIT 一致预期净利润（一期）
							if tnetProfit == "<nil>" {
								tnetProfit = defVal
							}
							r1.Retamaxprofits = tnetProfit //一致预期净利润（一期）

							teps := fmt.Sprintf("%v", insertedMap["TEPS"]) //TEPS 一致预期每股收益(一期）
							if teps == "<nil>" {
								teps = defVal
							}
							r1.Epsmaxfore = teps //一致预期每股收益(一期）

							rows = append(rows, r1)

						}

						//一致预测二期
						r2 := new(domain.PROFIT_FORECAST)
						r2.Symbol = symbol
						r2.Compcode = basicInfo.Compcode
						r2.Exchange = exchange //市场代码

						nendDate := fmt.Sprintf("%v", insertedMap["NENDDATE"]) //NENDDATE 预测截止日期（二期）
						if nendDate == "<nil>" {
							nendDate = ""
						}

						if len(nendDate) >= 4 {
							nendDate = nendDate[:4]
						}

						if len(nendDate) > 0 {
							r2.Exptyear = nendDate       //年度
							r2.Publishdate = publishDate //研报日期

							nmBizIncome := fmt.Sprintf("%v", insertedMap["NMBIZINCOME"]) //NMBIZINCOME 一致预期营业收入（二期）
							if nmBizIncome == "<nil>" {
								nmBizIncome = defVal
							}
							r2.Opermincome = nmBizIncome //一致预期营业收入（二期）

							nnetProfit := fmt.Sprintf("%v", insertedMap["NNETPROFIT"]) //NNETPROFIT 一致预期净利润（二期）
							if nnetProfit == "<nil>" {
								nnetProfit = defVal
							}
							r2.Retamaxprofits = nnetProfit //一致预期净利润（二期）

							neps := fmt.Sprintf("%v", insertedMap["NEPS"]) //NEPS 一致预期每股收益（二期）
							if neps == "<nil>" {
								neps = defVal
							}
							r2.Epsmaxfore = neps //一致预期每股收益（二期）

							rows = append(rows, r2)
						}

						//一致预测三期
						r3 := new(domain.PROFIT_FORECAST)
						r3.Symbol = symbol
						r3.Compcode = basicInfo.Compcode
						r3.Exchange = exchange //市场代码

						yanendDate := fmt.Sprintf("%v", insertedMap["YANENDDATE"]) //YANENDDATE 预测截止日期（三期）
						if yanendDate == "<nil>" {
							yanendDate = ""
						}

						if len(yanendDate) >= 4 {
							yanendDate = yanendDate[:4]
						}

						if len(yanendDate) > 0 {

							r3.Exptyear = yanendDate     //年度
							r3.Publishdate = publishDate //研报日期

							yanmBizIncome := fmt.Sprintf("%v", insertedMap["YANMBIZINCOME"]) //YANMBIZINCOME 一致预期营业收入(三期)
							if yanmBizIncome == "<nil>" {
								yanmBizIncome = defVal
							}

							r3.Opermincome = yanmBizIncome //一致预期营业收入(三期)

							yannetProfit := fmt.Sprintf("%v", insertedMap["YANNETPROFIT"]) //YANNETPROFIT 一致预期净利润（三期）
							if yannetProfit == "<nil>" {
								yannetProfit = defVal
							}
							r3.Retamaxprofits = yannetProfit //一致预期净利润（三期）

							yaneps := fmt.Sprintf("%v", insertedMap["YANEPS"]) //YANEPS 一致预期每股收益（三期）
							if yaneps == "<nil>" {
								yaneps = defVal
							}
							r3.Epsmaxfore = yaneps //一致预期每股收益（三期）

							rows = append(rows, r3)
						}

						for _, r := range rows {
							im := make(map[string]string)
							im["EXPTYEAR"] = r.Exptyear
							im["OPERMINCOME"] = r.Opermincome
							im["RETAMAXPROFITS"] = r.Retamaxprofits
							im["EPSMAXFORE"] = r.Epsmaxfore
							im["COMPCODE"] = r.Compcode
							im["SYMBOL"] = r.Symbol
							im["PUBLISHDATE"] = r.Publishdate
							im["EXCHANGE"] = exchange

							affected, err1 := h.TDB.InsertProfitForecastSingleNew(INSERT_PROFIT_FORECAST_SQL_NEW, im)
							if err1 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal 新增盈利预测出错:", zap.Any("err", err1))
							} else {
								global.LOG.Info("goCanal 新增盈利预测成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增公司业绩盈利预测"
							dm.SourceTable = "TQ_EXPT_SKSTATN"
							dm.TargetTable = "PROFIT_FORECAST"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err1 != nil {
								dm.ErrInfo = err1.Error()
							}
							mrows = append(mrows, dm)
						}

						if len(mrows) > 0 {
							affDm, err2 := h.TDB.InsertDataMonitor(mrows)
							if err2 != nil {
								global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
							}
							global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
						}

					}

				} // end of basicInfo != nil

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					updatedMap[e.Table.Columns[i].Name] = val
				}

				symbol := fmt.Sprintf("%v", updatedMap["SYMBOL"]) //证券代码
				basicInfo, errInf := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if errInf != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.根据symbol获取股票基本信息:", zap.Any("err", errInf))
				}

				//市场代码
				exchange := ""
				compcode := ""

				if basicInfo != nil {
					exchange = TransferExchane(basicInfo.Exchange)
					compcode = basicInfo.Compcode

					publishDate := fmt.Sprintf("%v", updatedMap["PUBLISHDATE"]) //研报日期
					if publishDate == "<nil>" {
						publishDate = ""
					}

					// 记录操作日志
					var mrows []*domain.DATA_MONITOR
					var rows []*domain.PROFIT_FORECAST

					defVal := "0.0000"

					//一致预测一期
					r1 := new(domain.PROFIT_FORECAST)
					r1.Symbol = symbol
					r1.Compcode = compcode
					r1.Exchange = exchange //市场代码

					tendDate := fmt.Sprintf("%v", updatedMap["TENDDATE"]) //TENDDATE 预测截止日期（一期）
					if tendDate == "<nil>" {
						tendDate = ""
					}
					//截取预测年度
					if len(tendDate) >= 4 {
						tendDate = tendDate[:4]
					}

					if len(tendDate) > 0 {
						r1.Exptyear = tendDate       //年度
						r1.Publishdate = publishDate //研报日期

						tmBizIncome := fmt.Sprintf("%v", updatedMap["TMBIZINCOME"]) //TMBIZINCOME 一致预期营业收入（一期）
						if tmBizIncome == "<nil>" {
							tmBizIncome = defVal
						}
						r1.Opermincome = tmBizIncome //一致预期营业收入（一期）

						tnetProfit := fmt.Sprintf("%v", updatedMap["TNETPROFIT"]) //TNETPROFIT 一致预期净利润（一期）
						if tnetProfit == "<nil>" {
							tnetProfit = defVal
						}
						r1.Retamaxprofits = tnetProfit //一致预期净利润（一期）

						teps := fmt.Sprintf("%v", updatedMap["TEPS"]) //TEPS 一致预期每股收益(一期）
						if teps == "<nil>" {
							teps = defVal
						}
						r1.Epsmaxfore = teps //一致预期每股收益(一期）

						rows = append(rows, r1)

					}

					//一致预测二期
					r2 := new(domain.PROFIT_FORECAST)
					r2.Symbol = symbol
					r2.Compcode = compcode
					r2.Exchange = exchange //市场代码

					nendDate := fmt.Sprintf("%v", updatedMap["NENDDATE"]) //NENDDATE 预测截止日期（二期）
					if nendDate == "<nil>" {
						nendDate = ""
					}

					if len(nendDate) >= 4 {
						nendDate = nendDate[:4]
					}

					if len(nendDate) > 0 {
						r2.Exptyear = nendDate       //年度
						r2.Publishdate = publishDate //研报日期

						nmBizIncome := fmt.Sprintf("%v", updatedMap["NMBIZINCOME"]) //NMBIZINCOME 一致预期营业收入（二期）
						if nmBizIncome == "<nil>" {
							nmBizIncome = defVal
						}
						r2.Opermincome = nmBizIncome //一致预期营业收入（二期）

						nnetProfit := fmt.Sprintf("%v", updatedMap["NNETPROFIT"]) //NNETPROFIT 一致预期净利润（二期）
						if nnetProfit == "<nil>" {
							nnetProfit = defVal
						}
						r2.Retamaxprofits = nnetProfit //一致预期净利润（二期）

						neps := fmt.Sprintf("%v", updatedMap["NEPS"]) //NEPS 一致预期每股收益（二期）
						if neps == "<nil>" {
							neps = defVal
						}
						r2.Epsmaxfore = neps //一致预期每股收益（二期）

						rows = append(rows, r2)
					}

					//一致预测三期
					r3 := new(domain.PROFIT_FORECAST)
					r3.Symbol = symbol
					r3.Compcode = compcode
					r3.Exchange = exchange //市场代码

					yanendDate := fmt.Sprintf("%v", updatedMap["YANENDDATE"]) //YANENDDATE 预测截止日期（三期）
					if yanendDate == "<nil>" {
						yanendDate = ""
					}

					if len(yanendDate) >= 4 {
						yanendDate = yanendDate[:4]
					}

					if len(yanendDate) > 0 {

						r3.Exptyear = yanendDate     //年度
						r3.Publishdate = publishDate //研报日期

						yanmBizIncome := fmt.Sprintf("%v", updatedMap["YANMBIZINCOME"]) //YANMBIZINCOME 一致预期营业收入(三期)
						if yanmBizIncome == "<nil>" {
							yanmBizIncome = defVal
						}

						r3.Opermincome = yanmBizIncome //一致预期营业收入(三期)

						yannetProfit := fmt.Sprintf("%v", updatedMap["YANNETPROFIT"]) //YANNETPROFIT 一致预期净利润（三期）
						if yannetProfit == "<nil>" {
							yannetProfit = defVal
						}
						r3.Retamaxprofits = yannetProfit //一致预期净利润（三期）

						yaneps := fmt.Sprintf("%v", updatedMap["YANEPS"]) //YANEPS 一致预期每股收益（三期）
						if yaneps == "<nil>" {
							yaneps = defVal
						}
						r3.Epsmaxfore = yaneps //一致预期每股收益（三期）

						rows = append(rows, r3)
					}

					for _, r := range rows {
						um := make(map[string]string)

						um["SYMBOL"] = r.Symbol
						um["COMPCODE"] = r.Compcode
						um["PUBLISHDATE"] = r.Publishdate
						um["EXPTYEAR"] = r.Exptyear
						um["OPERMINCOME"] = r.Opermincome
						um["RETAMAXPROFITS"] = r.Retamaxprofits
						um["EPSMAXFORE"] = r.Epsmaxfore

						affected, err1 := h.TDB.UpdateProfitForecastNew2(UPDATE_PROFIT_FORECAST_SQL_NEW2, um)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更新盈利预测出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 更新盈利预测成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = UPDATE_ACTION
						dm.BizDesc = "更新公司业绩盈利预测"
						dm.SourceTable = "TQ_EXPT_SKSTATN"
						dm.TargetTable = "PROFIT_FORECAST"

						r1json, _ := json.Marshal(e.Rows[1])
						dm.ModifiedDataJson = string(r1json) //更改后的值

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //更改前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						mrows = append(mrows, dm)
					}

					if len(mrows) > 0 {
						affDm, err2 := h.TDB.InsertDataMonitor(mrows)
						if err2 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}

				} // end of basicInfo != nil
			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val
				}

				//"DELETE FROM `PROFIT_FORECAST` WHERE `COMPCODE` = ? AND `SYMBOL` =? AND `PUBLISHDATE` = ?  "
				symbol := fmt.Sprintf("%v", deletedMap["SYMBOL"]) //证券代码
				basicInfo, errInf := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if errInf != nil {
					global.LOG.Error(">>>>>>>>>>goCanal delete.根据symbol获取股票基本信息:", zap.Any("err", errInf))
				}

				if basicInfo != nil {
					compCode := basicInfo.Compcode

					publishDate := fmt.Sprintf("%v", deletedMap["PUBLISHDATE"]) //研报日期

					delMap := make(map[string]string)

					delMap["SYMBOL"] = symbol
					delMap["COMPCODE"] = compCode
					delMap["PUBLISHDATE"] = publishDate

					affected, err := h.TDB.DeleteProfitForecastNew(DELETE_PROFIT_FORECAST_SQL_NEW, delMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 删除盈利预测出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 删除盈利预测成功:", zap.Int64("nums", affected))
					}

					//记录操作日志
					var rows []*domain.DATA_MONITOR

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除公司业绩盈利预测"
					dm.SourceTable = "TQ_EXPT_SKSTATN"
					dm.TargetTable = "PROFIT_FORECAST"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//个股预测_投资评级
		if e.Table.Name == "TQ_EXPT_SKINVRATING" || e.Table.Name == "tq_expt_skinvrating" {
			if e.Action == canal.UpdateAction {
				//每次变更根据证券代码 symbol 重新统计
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				symbol := fmt.Sprintf("%v", updatedMap["SYMBOL"])           //证券代码
				ratingValid := fmt.Sprintf("%v", updatedMap["RATINGVALID"]) //评级有效期

				ratingCount, err := h.CDB.GetStdRatingCountsBySymbolAndRatingValid(symbol, ratingValid)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.根据symbol和评级有效期获取评级机构统计对象失败:", zap.Any("err", err))
				}

				affected, err := h.TDB.UpdateRatingCount(UPDATE_RATING_COUNT_SQL, ratingCount)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更改评级机构统计数据出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更改评级机构统计数据成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新机构评级统计数据"
				dm.SourceTable = "TQ_EXPT_SKINVRATING"
				dm.TargetTable = "RATING_COUNT"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				//取得机构编码
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				//设置compcode
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.获取compCode失败:", zap.Any("err", err))
				}

				//SKCODE+REPORTDATE+RATINGVALID+ANALYSTNAME
				skCode := fmt.Sprintf("%v", updatedMap["SKCODE"])
				reportDate := fmt.Sprintf("%v", updatedMap["REPORTDATE"])
				analystName := fmt.Sprintf("%v", updatedMap["ANALYSTNAME"])

				stdRating := fmt.Sprintf("%v", updatedMap["STDRATING"])
				if stdRating != "" && stdRating != "<nil>" {
					updatedMap["RATING"] = stdRating // 标准评级-->评级
				}

				// 取得上次评级
				lastRating, err := h.TDB.GetLastRating(skCode, reportDate, ratingValid, analystName)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 获取上次评级数据出错:", zap.Any("err", err))
				}
				updatedMap["LASTRATING"] = lastRating //上次评级
				updatedMap["COMPCODE"] = compCode     //机构编码
				//ech := fmt.Sprintf("%v", updatedMap["EXCHANGE"])

				basicInfo, errInfo := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if errInfo != nil {
					global.LOG.Error("goCanal根据symbol获取股票基本信息失败:", zap.Any("err", err))
				}

				if basicInfo != nil {
					exchange := TransferExchane(basicInfo.Exchange)
					updatedMap["EXCHANGE"] = exchange

					ratingAffected, err := h.TDB.UpdateRating(UPDATE_RATING_SQL, updatedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 更改机构评级信息失败:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 更改机构评级信息成功:", zap.Int64("nums", ratingAffected))
					}

					dm1 := new(domain.DATA_MONITOR)
					dm1.Action = UPDATE_ACTION
					dm1.BizDesc = "更新机构评级信息"
					dm1.SourceTable = "TQ_EXPT_SKINVRATING"
					dm1.TargetTable = "RATING"

					r1json1, _ := json.Marshal(e.Rows[1])
					dm1.ModifiedDataJson = string(r1json1) //更改后的值

					r0json1, _ := json.Marshal(e.Rows[0])
					dm1.SourceDataJson = string(r0json1) //更改前的值
					dm1.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm1.ErrInfo = err.Error()
					}
					rows = append(rows, dm1)

				} //end of basicInfo != nil

				if len(rows) > 0 {
					affDm, errr := h.TDB.InsertDataMonitor(rows)
					if errr != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", errr))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				symbol := fmt.Sprintf("%v", insertedMap["SYMBOL"])           //证券代码
				ratingValid := fmt.Sprintf("%v", insertedMap["RATINGVALID"]) //评级有效期
				//ech := fmt.Sprintf("%v", insertedMap["EXCHANGE"])
				basicInfo, errInf := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if errInf != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.根据symbol获取股票基本信息:", zap.Any("err", errInf))
				}
				//市场代码
				exchange := ""
				if basicInfo != nil {
					exchange = TransferExchane(basicInfo.Exchange)
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				has, _ := h.TDB.HasRatingCount(symbol, ratingValid)
				if has { //如果存在则更新
					ratingCount, err := h.CDB.GetStdRatingCountsBySymbolAndRatingValid(symbol, ratingValid)
					if err != nil {
						global.LOG.Error(">>>>>>>>>>goCanal insert.根据symbol和评级有效期获取评级机构统计对象失败:", zap.Any("err", err))
					}

					affected, err := h.TDB.UpdateRatingCount(UPDATE_RATING_COUNT_SQL, ratingCount)

					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 新增-->更新评级机构统计数据出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal  新增-->更新评级机构统计数据成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = INSERT_ACTION
					dm.BizDesc = "新增机构评级统计数据"
					dm.SourceTable = "TQ_EXPT_SKINVRATING"
					dm.TargetTable = "RATING_COUNT"
					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json)   //新增的值
					dm.ModifiedDataJson = string(r0json) //新增后的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

				} else { //否则插入

					compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
					if err != nil {
						global.LOG.Error(">>>>>>>>>>goCanal insert.获取compCode失败:", zap.Any("err", err))
					}

					ratingCount, err := h.CDB.GetStdRatingCountsBySymbolAndRatingValid(symbol, ratingValid)
					if err != nil {
						global.LOG.Error(">>>>>>>>>>goCanal insert.根据symbol和评级有效期获取评级机构统计对象失败:", zap.Any("err", err))
					}

					ratingCount.Exchange = exchange
					ratingCount.Compcode = compCode                                                                                                           //机构编码
					ratingCount.Stdrating = STDRATING_BUY + "," + STDRATING_ENLARGE + "," + STDRATING_NEUTRAL + "," + STDRATING_REDUCE + "," + STDRATING_SELL //写死

					affected, err := h.TDB.InsertRatingCountSingle(INSERT_RATING_COUNT_SQL, ratingCount)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal 新增评级机构统计数据出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal 新增评级机构统计数据成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = INSERT_ACTION
					dm.BizDesc = "新增机构评级统计数据"
					dm.SourceTable = "TQ_EXPT_SKINVRATING"
					dm.TargetTable = "RATING_COUNT"
					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json)   //新增的值
					dm.ModifiedDataJson = string(r0json) //新增后的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)
				}

				//机构评级信息
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				//设置symbol
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.获取compCode失败:", zap.Any("err", err))
				}

				//rating := fmt.Sprintf("%v", insertedMap["RATING"])
				rating := fmt.Sprintf("%v", insertedMap["STDRATING"])
				if rating != "" && rating != "<nil>" {
					insertedMap["RATING"] = rating
					insertedMap["LASTRATING"] = rating //上次评级
				}

				insertedMap["COMPCODE"] = compCode //机构编码
				insertedMap["EXCHANGE"] = exchange

				ratingAffected, err := h.TDB.InsertRatingSingle(INSERT_RATING_SQL, insertedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 新增机构评级信息失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 新增机构评级信息成功:", zap.Int64("nums", ratingAffected))
				}

				dm := new(domain.DATA_MONITOR)
				dm.Action = INSERT_ACTION
				dm.BizDesc = "新增机构评级信息"
				dm.SourceTable = "TQ_EXPT_SKINVRATING"
				dm.TargetTable = "RATING"
				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json)   //新增的值
				dm.ModifiedDataJson = string(r0json) //新增后的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

					deletedMap[e.Table.Columns[i].Name] = val
				}

				//symbol := fmt.Sprintf("%v", deletedMap["SYMBOL"]) //证券代码
				//ratingValid := fmt.Sprintf("%v", deletedMap["RATINGVALID"])//评级有效期

				affected, err := h.TDB.DeleteRatingCount(DELETE_RATING_COUNT_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除评级机构统计出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除评级机构统计成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除->更新机构评级统计数据"
				dm.SourceTable = "TQ_EXPT_SKINVRATING"
				dm.TargetTable = "RATING_COUNT"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				//机构评级信息
				/*
					compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
					//设置symbol
					if err != nil {
						global.LOG.Error(">>>>>>>>>>goCanal insert.获取compCode失败:", zap.Any("err", err))
					}
					deletedMap["COMPCODE"] = compCode //上次评级
				*/
				ratingAffected, err := h.TDB.DeleteRating(DELETE_RATING_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除机构评级信息出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除机构评级信息成功:", zap.Int64("nums", ratingAffected))
				}

				dm1 := new(domain.DATA_MONITOR)
				dm1.Action = DELETE_ACTION
				dm1.BizDesc = "删除机构评级信息"
				dm1.SourceTable = "TQ_EXPT_SKINVRATING"
				dm1.TargetTable = "RATING"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json1, _ := json.Marshal(e.Rows[0])
				dm1.SourceDataJson = string(r0json1) //删除前的值
				dm1.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm1.ErrInfo = err.Error()
				}
				rows = append(rows, dm1)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}

		}
		//股本结构变化
		if e.Table.Name == "TQ_SK_SHARESTRUCHG" || e.Table.Name == "tq_sk_sharestruchg" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				//symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				//if err != nil {
				//	global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
				//}

				circskamt := fmt.Sprintf("%v", updatedMap["CIRCSKAMT"])
				if circskamt == "<nil>" {
					circskamt = ""
				}
				updatedMap["CIRCSKAMTNOLIM"] = circskamt

				circskrtonolim := fmt.Sprintf("%v", updatedMap["CIRCSKRTO"])
				if circskrtonolim == "<nil>" {
					circskrtonolim = ""
				}
				updatedMap["CIRCSKRTONOLIM"] = circskrtonolim

				ncircamt1 := fmt.Sprintf("%v", updatedMap["NCIRCAMT"])
				if ncircamt1 == "<nil>" {
					ncircamt1 = ""
				}
				updatedMap["NCIRCAMT1"] = ncircamt1

				nonnegskrto1 := fmt.Sprintf("%v", updatedMap["NONNEGSKRTO"])
				if nonnegskrto1 == "<nil>" {
					nonnegskrto1 = ""
				}
				updatedMap["NONNEGSKRTO1"] = nonnegskrto1

				//for _, symbol := range symbols {
				//设置symbol
				//	updatedMap["SYMBOL"] = symbol

				// 股本结构
				affected, err1 := h.TDB.UpdateEquityStructure(UPDATE_EQUITY_STRUCTURE_SQL, updatedMap)
				if err1 != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更改股本结构出错:", zap.Any("err", err1))
				} else {
					global.LOG.Info("goCanal 更改股本结构成功:", zap.Int64("nums", affected))
				}

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新股本结构数据"
				dm.SourceTable = "TQ_SK_SHARESTRUCHG"
				dm.TargetTable = "EQUITY_STRUCTURE"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err1 != nil {
					dm.ErrInfo = err1.Error()
				}
				rows = append(rows, dm)

				//股本变动数据
				affectedChg, err2 := h.TDB.UpdatetEquityStruChg(UPDATE_EQUITY_STRUCTURE_CHANGE_SQL, updatedMap)
				if err2 != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更改股本变动数据出错:", zap.Any("err", err2))
				} else {
					global.LOG.Info("goCanal 更改股本变动数据成功:", zap.Int64("nums", affectedChg))
				}

				dm1 := new(domain.DATA_MONITOR)
				dm1.Action = UPDATE_ACTION
				dm1.BizDesc = "更新股本变动数据"
				dm1.SourceTable = "TQ_SK_SHARESTRUCHG"
				dm1.TargetTable = "EQUITY_STRUCTURE_CHANGE"

				r1json1, _ := json.Marshal(e.Rows[1])
				dm1.ModifiedDataJson = string(r1json1) //更改后的值

				r0json1, _ := json.Marshal(e.Rows[0])
				dm1.SourceDataJson = string(r0json1) //更改前的值
				dm1.ActionTime = utils.GetNowTimeStr()
				if err2 != nil {
					dm1.ErrInfo = err2.Error()
				}
				rows = append(rows, dm1)

				affDm, err3 := h.TDB.InsertDataMonitor(rows)
				if err3 != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

				//	}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						circskamt := fmt.Sprintf("%v", insertedMap["CIRCSKAMT"])
						if circskamt == "<nil>" {
							circskamt = "0"
						}
						insertedMap["CIRCSKAMTNOLIM"] = circskamt

						circskrtonolim := fmt.Sprintf("%v", insertedMap["CIRCSKRTO"])
						if circskrtonolim == "<nil>" {
							circskrtonolim = "0"
						}
						insertedMap["CIRCSKRTONOLIM"] = circskrtonolim

						ncircamt1 := fmt.Sprintf("%v", insertedMap["NCIRCAMT"])
						if ncircamt1 == "<nil>" {
							ncircamt1 = "0"
						}
						insertedMap["NCIRCAMT1"] = ncircamt1

						nonnegskrto1 := fmt.Sprintf("%v", insertedMap["NONNEGSKRTO"])
						if nonnegskrto1 == "<nil>" {
							nonnegskrto1 = "0"
						}
						insertedMap["NONNEGSKRTO1"] = nonnegskrto1

						//股本结构
						affected, err1 := h.TDB.InsertEquityStructureSingle(INSERT_EQUITY_STRUCTURE_SQL, insertedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增股本结构出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 新增股本结构成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = INSERT_ACTION
						dm.BizDesc = "新增股本结构数据"
						dm.SourceTable = "TQ_SK_SHARESTRUCHG"
						dm.TargetTable = "EQUITY_STRUCTURE"
						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json)   //新增的值
						dm.ModifiedDataJson = string(r0json) //新增后的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

						//股本变动
						affectedEsc, err2 := h.TDB.InsertEquityStruChgSingle(INSERT_EQUITY_STRUCTURE_CHANGE_SQL, insertedMap)
						if err2 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增股本变动出错:", zap.Any("err", err2))
						} else {
							global.LOG.Info("goCanal 新增股本变动成功:", zap.Int64("nums", affectedEsc))
						}

						dm1 := new(domain.DATA_MONITOR)
						dm1.Action = INSERT_ACTION
						dm1.BizDesc = "新增股本变动数据"
						dm1.SourceTable = "TQ_SK_SHARESTRUCHG"
						dm1.TargetTable = "EQUITY_STRUCTURE_CHANGE"
						r0json1, _ := json.Marshal(e.Rows[0])
						dm1.SourceDataJson = string(r0json1)   //新增的值
						dm1.ModifiedDataJson = string(r0json1) //新增后的值
						dm1.ActionTime = utils.GetNowTimeStr()
						if err2 != nil {
							dm1.ErrInfo = err2.Error()
						}
						rows = append(rows, dm1)

						affDm, err3 := h.TDB.InsertDataMonitor(rows)
						if err3 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

					}
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				//compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
				//symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				//if err != nil {
				//	global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
				//}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				//	for _, symbol := range symbols {
				//设置symbol
				//		deletedMap["SYMBOL"] = symbol

				//股本结构
				affected, err1 := h.TDB.DeleteEquityStructure(DELETE_EQUITY_STRUCTURE_SQL, deletedMap)
				if err1 != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除股本结构出错:", zap.Any("err", err1))
				} else {
					global.LOG.Info("goCanal 删除股本结构成功:", zap.Int64("nums", affected))
				}
				//	}

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除股本结构数据"
				dm.SourceTable = "TQ_SK_SHARESTRUCHG"
				dm.TargetTable = "EQUITY_STRUCTURE"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err1 != nil {
					dm.ErrInfo = err1.Error()
				}
				rows = append(rows, dm)

				affectedEsc, err2 := h.TDB.DeletetEquityStruChg(DELETE_EQUITY_STRUCTURE_CHANGE_SQL, deletedMap)
				if err2 != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除股本变动出错:", zap.Any("err", err2))
				} else {
					global.LOG.Info("goCanal 删除股本变动成功:", zap.Int64("nums", affectedEsc))
				}

				dm1 := new(domain.DATA_MONITOR)
				dm1.Action = DELETE_ACTION
				dm1.BizDesc = "删除股本变动数据"
				dm1.SourceTable = "TQ_SK_SHARESTRUCHG"
				dm1.TargetTable = "EQUITY_STRUCTURE_CHANGE"
				dm1.ModifiedDataJson = "" //删除后的值为空

				r0json1, _ := json.Marshal(e.Rows[0])
				dm1.SourceDataJson = string(r0json1) //删除前的值
				dm1.ActionTime = utils.GetNowTimeStr()
				if err2 != nil {
					dm1.ErrInfo = err2.Error()
				}
				rows = append(rows, dm1)

				affDm, err3 := h.TDB.InsertDataMonitor(rows)
				if err3 != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		//流通股东名单
		if e.Table.Name == "TQ_SK_OTSHOLDER" || e.Table.Name == "tq_sk_otsholder" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal update.获取symbol失败:", zap.Any("err", err))
					return err
				}

				endDate := fmt.Sprintf("%v", updatedMap["ENDDATE"])
				if endDate != "" && endDate != "<nil>" {
					updatedMap["PUBLISHDATE"] = endDate
				}
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						updatedMap["SYMBOL"] = symbol

						affected, err1 := h.TDB.UpdateTenCirculatingSharesHolder(UPDATE_TEN_CIRCULATING_SHARES_HOLDER_SQL, updatedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更改十大流通股股东出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 更改十大流通股股东成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = UPDATE_ACTION
						dm.BizDesc = "更新十大流通股股东"
						dm.SourceTable = "TQ_SK_OTSHOLDER"
						dm.TargetTable = "TEN_CIRCULATING_SHARES_HOLDER"

						r1json, _ := json.Marshal(e.Rows[1])
						dm.ModifiedDataJson = string(r1json) //更改后的值

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //更改前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

						affDm, err2 := h.TDB.InsertDataMonitor(rows)
						if err2 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
					}
				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
				if endDate != "" && endDate != "<nil>" {
					insertedMap["PUBLISHDATE"] = endDate
				}
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						affected, err1 := h.TDB.InsertTenCirculatingSharesHolderSingle(INSERT_TEN_CIRCULATING_SHARES_HOLDER_SQL, insertedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增十大流通股股东出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 新增十大流通股股东成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = INSERT_ACTION
						dm.BizDesc = "新增十大流通股股东"
						dm.SourceTable = "TQ_SK_OTSHOLDER"
						dm.TargetTable = "TEN_CIRCULATING_SHARES_HOLDER"
						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json)   //新增的值
						dm.ModifiedDataJson = string(r0json) //新增后的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

						affDm, err2 := h.TDB.InsertDataMonitor(rows)
						if err2 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

					}
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						deletedMap["SYMBOL"] = symbol

						affected, err1 := h.TDB.DeleteTenCirculatingSharesHolder(DELETE_TEN_CIRCULATING_SHARES_HOLDER_SQL, deletedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 删除十大流通股股东出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 删除十大流通股股东成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = DELETE_ACTION
						dm.BizDesc = "删除十大流通股股东"
						dm.SourceTable = "TQ_SK_OTSHOLDER"
						dm.TargetTable = "TEN_CIRCULATING_SHARES_HOLDER"
						dm.ModifiedDataJson = "" //删除后的值为空

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //删除前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

						affDm, err2 := h.TDB.InsertDataMonitor(rows)
						if err2 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

					}
				}

			}
		}
		//龙虎榜-交易公开信息营业部
		if e.Table.Name == "TQ_QT_BIZUNITTRDINFO" || e.Table.Name == "tq_qt_bizunittrdinfo" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				symbol := fmt.Sprintf("%v", updatedMap["SYMBOL"])
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				//设置symbol
				updatedMap["COMPCODE"] = compCode
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.获取compCode失败:", zap.Any("err", err))
				}

				//设置EXCHANGE
				//exch := fmt.Sprintf("%v", updatedMap["EXCHANGE"])
				basicInfo, errInfo := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if errInfo != nil {
					global.LOG.Error("goCanal 根据Symbol获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					exchange := TransferExchane(basicInfo.Exchange)
					updatedMap["EXCHANGE"] = exchange
				}

				affected, err := h.TDB.UpdateRankList(UPDATE_RANK_LIST_SQL, updatedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更新龙虎榜失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更新龙虎榜成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新龙虎榜信息"
				dm.SourceTable = "TQ_QT_BIZUNITTRDINFO"
				dm.TargetTable = "RANK_LIST"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				symbol := fmt.Sprintf("%v", insertedMap["SYMBOL"])
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				//设置symbol
				insertedMap["COMPCODE"] = compCode
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.获取compCode失败:", zap.Any("err", err))
				}

				//设置EXCHANGE
				//exch := fmt.Sprintf("%v", insertedMap["EXCHANGE"])
				basicInfo, errInfo := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if errInfo != nil {
					global.LOG.Error("goCanal 根据Symbol获取股票基本信息失败:", zap.Any("err", err))
				}

				if basicInfo != nil {
					exchange := TransferExchane(basicInfo.Exchange)
					insertedMap["EXCHANGE"] = exchange
				}

				affected, err := h.TDB.InsertRankListSingle(INSERT_RANK_LIST_SQL, insertedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 新增龙虎榜失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 新增龙虎榜成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = INSERT_ACTION
				dm.BizDesc = "新增龙虎榜信息"
				dm.SourceTable = "TQ_QT_BIZUNITTRDINFO"
				dm.TargetTable = "RANK_LIST"
				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json)   //新增的值
				dm.ModifiedDataJson = string(r0json) //新增后的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

					deletedMap[e.Table.Columns[i].Name] = val
				}

				affected, err := h.TDB.DeleteRankList(DELETE_RANK_LIST_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除龙虎榜失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除龙虎榜成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除龙虎榜信息"
				dm.SourceTable = "TQ_QT_BIZUNITTRDINFO"
				dm.TargetTable = "RANK_LIST"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		//大宗交易
		if e.Table.Name == "TQ_QT_BLOCKTRADE" || e.Table.Name == "tq_qt_blocktrade" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				symbol := fmt.Sprintf("%v", updatedMap["SYMBOL"])
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.获取compCode失败:", zap.Any("err", err))
				}
				//设置symbol
				updatedMap["COMPCODE"] = compCode

				//设置exchange
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal update.根据symbol 获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					exchange := basicInfo.Exchange
					updatedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				affected, err := h.TDB.UpdateBlockTrading(UPDATE_BLOCK_TRADING_SQL, updatedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更改大宗交易失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更改大宗交易成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新大宗交易"
				dm.SourceTable = "TQ_QT_BLOCKTRADE"
				dm.TargetTable = "BLOCK_TRADING"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				symbol := fmt.Sprintf("%v", insertedMap["SYMBOL"])
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.获取compCode失败:", zap.Any("err", err))
				}
				//设置compCode
				insertedMap["COMPCODE"] = compCode

				//设置exchange
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal insert.根据Symbol获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					exchange := basicInfo.Exchange
					insertedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				affected, err := h.TDB.InsertBlockTradingSingle(INSERT_BLOCK_TRADING_SQL, insertedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 新增大宗交易失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 新增大宗交易成功:", zap.Int64("nums", affected))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = INSERT_ACTION
				dm.BizDesc = "新增大宗交易"
				dm.SourceTable = "TQ_QT_BLOCKTRADE"
				dm.TargetTable = "BLOCK_TRADING"
				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json)   //新增的值
				dm.ModifiedDataJson = string(r0json) //新增后的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

					deletedMap[e.Table.Columns[i].Name] = val
				}

				symbol := fmt.Sprintf("%v", deletedMap["SYMBOL"])
				//设置exchange
				basicInfo, err := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if err != nil {
					global.LOG.Error(">>>>>>>>>>goCanal delete.根据Symbol获取股票基本信息失败:", zap.Any("err", err))
				}
				if basicInfo != nil {
					exchange := basicInfo.Exchange
					deletedMap["EXCHANGE"] = TransferExchane(exchange)
				}

				affected, err := h.TDB.DeleteBlockTrading(DELETE_BLOCK_TRADING_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除大宗交易失败:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除大宗交易成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除大宗交易"
				dm.SourceTable = "TQ_QT_BLOCKTRADE"
				dm.TargetTable = "BLOCK_TRADING"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		//公司高管-入职和辞职的信息表
		if e.Table.Name == "TQ_COMP_MANAGER" || e.Table.Name == "tq_comp_manager" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				//compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				//symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				//if err != nil {
				//	global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
				//}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//	for _, symbol := range symbols {
				//设置symbol
				//		updatedMap["SYMBOL"] = symbol

				//人物代码
				personalCode := fmt.Sprintf("%v", updatedMap["PERSONALCODE"])
				//人物代码查询 TQ_COMP_PERSONRECORD 个人档案表
				pr, err1 := h.CDB.GetPersonRecordByPersonalCode(personalCode)
				if err1 != nil {
					global.LOG.Error("goCanal.TQ_COMP_MANAGER 获取个人档案信息失败:", zap.Any("err", err1))
					return err1
				}
				if pr != nil {
					updatedMap["GENDER"] = pr.Gender //性别
					if len(pr.Birthday) >= 4 {
						updatedMap["BIRTHDAY"] = pr.Birthday[0:4] //出生日期
					}
					updatedMap["DEGREE"] = pr.Degree //最高学历
					updatedMap["MEMO"] = pr.Memo     //备注

				}

				affected, err2 := h.TDB.UpdateCompanyExecutives(UPDATE_COMPANY_EXECUTIVES_SQL, updatedMap)
				if err2 != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal.TQ_COMP_MANAGER 更新公司高管信息出错:", zap.Any("err", err2))
				} else {
					global.LOG.Info("goCanal.TQ_COMP_MANAGER 更新公司高管信息成功:", zap.Int64("nums", affected))
				}

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新公司高管信息"
				dm.SourceTable = "TQ_COMP_MANAGER"
				dm.TargetTable = "COMPANY_EXECUTIVES"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err2 != nil {
					dm.ErrInfo = err2.Error()
				}
				rows = append(rows, dm)

				affDm, err3 := h.TDB.InsertDataMonitor(rows)
				if err3 != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

				//	}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						//人物代码
						personalCode := fmt.Sprintf("%v", insertedMap["PERSONALCODE"])
						//人物代码查询 TQ_COMP_PERSONRECORD 个人档案表
						pr, err1 := h.CDB.GetPersonRecordByPersonalCode(personalCode)
						if err1 != nil {
							global.LOG.Error("goCanal.TQ_COMP_MANAGER 获取个人档案信息失败:", zap.Any("err", err1))
						}
						if pr != nil {
							insertedMap["GENDER"] = pr.Gender //性别
							if len(pr.Birthday) >= 4 {
								insertedMap["BIRTHDAY"] = pr.Birthday[0:4] //出生日期
							}
							insertedMap["DEGREE"] = pr.Degree //最高学历
							insertedMap["MEMO"] = pr.Memo     //备注
						}

						affected, err2 := h.TDB.InsertCompanyExecutivesSingle(INSERT_COMPANY_EXECUTIVES_SQL, insertedMap)
						if err2 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal.TQ_COMP_MANAGER 新增公司高管信息出错:", zap.Any("err", err2))
						} else {
							global.LOG.Info("goCanal.TQ_COMP_MANAGER 新增公司高管信息成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = INSERT_ACTION
						dm.BizDesc = "新增公司高管信息"
						dm.SourceTable = "TQ_COMP_MANAGER"
						dm.TargetTable = "COMPANY_EXECUTIVES"
						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json)   //新增的值
						dm.ModifiedDataJson = string(r0json) //新增后的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err2 != nil {
							dm.ErrInfo = err2.Error()
						}
						rows = append(rows, dm)

						affDm, err3 := h.TDB.InsertDataMonitor(rows)
						if err3 != nil {
							global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
						}
						global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

					}
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

					deletedMap[e.Table.Columns[i].Name] = val
				}

				affected, err := h.TDB.DeleteCompanyExecutives(DELETE_COMPANY_EXECUTIVES_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal.TQ_COMP_MANAGER 删除公司高管信息出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal.TQ_COMP_MANAGER 删除公司高管信息成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除公司高管信息"
				dm.SourceTable = "TQ_COMP_MANAGER"
				dm.TargetTable = "COMPANY_EXECUTIVES"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		//公司高管-个人档案信息
		if e.Table.Name == "TQ_COMP_PERSONRECORD" || e.Table.Name == "tq_comp_personrecord" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//人物代码
				personalCode := fmt.Sprintf("%v", updatedMap["PERSONALCODE"])
				//生日只截取年
				birthday := fmt.Sprintf("%v", updatedMap["BIRTHDAY"])
				if len(birthday) >= 4 && birthday != "<nil>" {
					birthdaySub := birthday[:4]
					updatedMap["BIRTHDAY"] = birthdaySub
				}

				//根据人物代码，查询公司高管入职和辞职等信息
				cm, err := h.CDB.GetCompManagerByPersonalCode(personalCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_PERSONRECORD 获取公司高管信息失败:", zap.Any("err", err))
					return err
				}
				if cm != nil {
					compCode := cm.Compcode
					symbols, err1 := h.CDB.GetSymbolByCompCode(compCode)
					if err1 != nil {
						global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err1))
					}
					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							updatedMap["SYMBOL"] = symbol

							updatedMap["COMPCODE"] = compCode
							updatedMap["ACTDUTYNAME"] = cm.Actdutyname //实际职位名称
							updatedMap["CNAME"] = cm.Cname             //姓名
							updatedMap["BEGINDATE"] = cm.Begindate     //在职起始日期
							updatedMap["POSTYPE"] = cm.Postype         //职位属性
							updatedMap["NOWSTATUS"] = cm.Nowstatus     //当前状态

							affected, err2 := h.TDB.UpdateCompanyExecutives(UPDATE_COMPANY_EXECUTIVES_SQL, updatedMap)
							if err2 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal.TQ_COMP_PERSONRECORD 更新公司高管信息出错:", zap.Any("err", err2))
							} else {
								global.LOG.Info("goCanal.TQ_COMP_PERSONRECORD 更新公司高管信息成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = UPDATE_ACTION
							dm.BizDesc = "更新公司高管信息"
							dm.SourceTable = "TQ_COMP_PERSONRECORD"
							dm.TargetTable = "COMPANY_EXECUTIVES"

							r1json, _ := json.Marshal(e.Rows[1])
							dm.ModifiedDataJson = string(r1json) //更改后的值

							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json) //更改前的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err2 != nil {
								dm.ErrInfo = err2.Error()
							}
							rows = append(rows, dm)

							affDm, err3 := h.TDB.InsertDataMonitor(rows)
							if err3 != nil {
								global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
							}
							global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

						}
					}

				}

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}
				//人物代码
				personalCode := fmt.Sprintf("%v", insertedMap["PERSONALCODE"])

				//生日只截取年
				birthday := fmt.Sprintf("%v", insertedMap["BIRTHDAY"])
				if len(birthday) >= 4 && birthday != "<nil>" {
					birthdaySub := birthday[:4]
					insertedMap["BIRTHDAY"] = birthdaySub
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//根据人物代码，查询公司高管入职和辞职等信息
				cm, err := h.CDB.GetCompManagerByPersonalCode(personalCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_PERSONRECORD 获取公司高管信息失败:", zap.Any("err", err))
					return err
				}

				if cm != nil {
					compCode := cm.Compcode
					symbols, err1 := h.CDB.GetSymbolByCompCode(compCode)
					if err1 != nil {
						global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					}

					if symbols != nil {
						for _, symbol := range symbols {
							//设置symbol
							insertedMap["SYMBOL"] = symbol.Symbol
							insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)
							insertedMap["COMPCODE"] = compCode
							insertedMap["ACTDUTYNAME"] = cm.Actdutyname //实际职位名称
							insertedMap["CNAME"] = cm.Cname             //姓名
							insertedMap["BEGINDATE"] = cm.Begindate     //在职起始日期
							insertedMap["POSTYPE"] = cm.Postype         //职位属性
							insertedMap["NOWSTATUS"] = cm.Nowstatus     //当前状态

							affected, err2 := h.TDB.InsertCompanyExecutivesSingle(INSERT_COMPANY_EXECUTIVES_SQL, insertedMap)
							if err2 != nil {
								//仅记录出错日志，不退出程序，
								global.LOG.Error("goCanal.TQ_COMP_PERSONRECORD 新增司高管信息出错:", zap.Any("err", err2))
							} else {
								global.LOG.Info("goCanal.TQ_COMP_PERSONRECORD 新增公司高管信息成功:", zap.Int64("nums", affected))
							}

							dm := new(domain.DATA_MONITOR)
							dm.Action = INSERT_ACTION
							dm.BizDesc = "新增公司高管信息"
							dm.SourceTable = "TQ_COMP_PERSONRECORD"
							dm.TargetTable = "COMPANY_EXECUTIVES"
							r0json, _ := json.Marshal(e.Rows[0])
							dm.SourceDataJson = string(r0json)   //新增的值
							dm.ModifiedDataJson = string(r0json) //新增后的值
							dm.ActionTime = utils.GetNowTimeStr()
							if err2 != nil {
								dm.ErrInfo = err2.Error()
							}
							rows = append(rows, dm)

							affDm, err3 := h.TDB.InsertDataMonitor(rows)
							if err3 != nil {
								global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
							}
							global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

						}
					}

				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[0] {

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))

					deletedMap[e.Table.Columns[i].Name] = val
				}

				//人物代码
				personalCode := fmt.Sprintf("%v", deletedMap["PERSONALCODE"])

				//根据人物代码，查询公司高管入职和辞职等信息
				cm, err := h.CDB.GetCompManagerByPersonalCode(personalCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_PERSONRECORD 获取公司高管信息失败:", zap.Any("err", err))
					return err
				}

				if cm != nil {
					compCode := cm.Compcode
					deletedMap["COMPCODE"] = compCode
					deletedMap["ACTDUTYNAME"] = cm.Actdutyname //实际职位名称
					deletedMap["BEGINDATE"] = cm.Begindate     //在职起始日期
				}

				affected, err := h.TDB.DeleteCompanyExecutives(DELETE_COMPANY_EXECUTIVES_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal.TQ_COMP_PERSONRECORD 删除公司高管信息出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal.TQ_COMP_PERSONRECORD 删除公司高管信息成功:", zap.Int64("nums", affected))

				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除公司高管信息"
				dm.SourceTable = "TQ_COMP_PERSONRECORD"
				dm.TargetTable = "COMPANY_EXECUTIVES"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		//公司经营情况
		if e.Table.Name == "TQ_SK_BUSIINFO" || e.Table.Name == "tq_sk_busiinfo" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						//取得分类口径
						typeStyle := fmt.Sprintf("%v", insertedMap["TYPESTYLE"])
						if typeStyle == TYPE_STYLE_PRODUCT { //分类口径：产品
							//报表日期
							publishDate := fmt.Sprintf("%v", insertedMap["PUBLISHDATE"])

							//如果新增的数据是最新的报表日期数据，则新增
							//根据PUBLISHDATE+SYMBOL取得该证券最新报表日期的数据
							mainComposition, e1 := h.TDB.GetLatestPublishDateMainComposition(symbol.Symbol, compCode)
							if e1 != nil {
								global.LOG.Error(">>>>>>>>>>goCanal 根据symbol获取最新报表日期的公司经营状况数据失败:", zap.Any("err", e1))
							}
							maxPublishDate := "19000101"
							if mainComposition != nil && len(mainComposition.Symbol) > 0 {
								maxPublishDate = mainComposition.Publishdate
							}
							//如果新增数据的发布日期是最新的(包括批量新增业务产品信息)，则进行新增操作
							if strings.Compare(publishDate, maxPublishDate) == 1 || strings.Compare(publishDate, maxPublishDate) == 0 {
								//转换为报告期
								reportYear := publishDate[0:4]
								//分类值
								className := fmt.Sprintf("%v", insertedMap["CLASSNAME"])
								//本期主营业务收入
								tCoreBizIncome := fmt.Sprintf("%v", insertedMap["TCOREBIZINCOME"])
								if tCoreBizIncome == "<nil>" {
									tCoreBizIncome = "0"
								}
								// 占主营业务收入比例
								coreBizIIncRto := fmt.Sprintf("%v", insertedMap["COREBIZINCRTO"])
								if coreBizIIncRto == "<nil>" {
									coreBizIIncRto = "0"
								}
								bci := new(domain.BUSI_CLASS_INFO)
								bci.CLASSNAME = className
								bci.TCOREBIZINCOME = tCoreBizIncome
								bci.COREBIZINCRTO = coreBizIIncRto

								productInfo, err1 := json.Marshal(bci)
								if err1 != nil {
									global.LOG.Error("goCanal TQ_SK_BUSIINFO.json.Marshal公司经营状况失败:", zap.Any("err", err))
								}

								existProductInfo := mainComposition.Productinfo
								if len(existProductInfo) > 0 {
									if len(string(productInfo)) > 0 {
										existProductInfo = existProductInfo + "," + string(productInfo)
									}
								}

								if len(existProductInfo) > 0 {
									insertedMap["PRODUCTINFO"] = existProductInfo //产品业务口径JSON字符串
								} else {
									insertedMap["PRODUCTINFO"] = string(productInfo) //产品业务口径JSON字符串
								}

								incstatementNews, err2 := h.CDB.GetTqFinPrgIncStatementNewByCompCodeAndReportYear(compCode, reportYear)
								if err2 != nil {
									global.LOG.Error("goCanal TQ_SK_BUSIINFO. 根据机构编码和报告期获取企业利润信息失败:", zap.String("compCode", compCode), zap.String("reportYear", reportYear), zap.Any("err", err))
								}

								if incstatementNews != nil {

									maxRecord := incstatementNews[0]
									//取最新报告期类型的数据
									for _, r := range incstatementNews {
										if strings.Compare(maxRecord.Reportdatetype, r.Reportdatetype) == -1 {
											maxRecord = r
										}
									}

									if maxRecord != nil && len(maxRecord.Compcode) > 0 {
										insertedMap["BIZTOTCOST"] = maxRecord.Biztotcost //营业总成本
										insertedMap["PERPROFIT"] = maxRecord.Perprofit   //营业利润
										insertedMap["REPORTYEAR"] = maxRecord.Reportyear //会计年度

										//批量更新
										if len(existProductInfo) > 0 {
											affectedMc, err3 := h.TDB.UpdateMainComposition(UPDATE_MAIN_COMPOSITION_SQL, insertedMap)
											if err3 != nil {
												//仅记录出错日志，不退出程序，
												global.LOG.Error("goCanal.TQ_SK_BUSIINFO 新增-->更新公司主要业务出错:", zap.Any("err", err3))
											} else {
												global.LOG.Info("goCanal.TQ_SK_BUSIINFO  新增-->更新公司主要业务成功:", zap.Int64("nums", affectedMc))
											}
											dm := new(domain.DATA_MONITOR)
											dm.Action = INSERT_ACTION
											dm.BizDesc = "新增公司主要业务数据"
											dm.SourceTable = "TQ_SK_BUSIINFO"
											dm.TargetTable = "MAIN_COMPOSITION"
											r0json, _ := json.Marshal(e.Rows[0])
											dm.SourceDataJson = string(r0json)   //新增的值
											dm.ModifiedDataJson = string(r0json) //新增后的值
											dm.ActionTime = utils.GetNowTimeStr()
											if err3 != nil {
												dm.ErrInfo = err3.Error()
											}
											rows = append(rows, dm)

										} else {
											affectedMc, errI := h.TDB.InsertMainCompositionSingle(INSERT_MAIN_COMPOSITION_SQL, insertedMap)
											if errI != nil {
												//仅记录出错日志，不退出程序，
												global.LOG.Error("goCanal.TQ_SK_BUSIINFO 新增公司主要业务出错:", zap.Any("err", errI))
											} else {
												global.LOG.Info("goCanal.TQ_SK_BUSIINFO  新增公司主要业务成功:", zap.Int64("nums", affectedMc))
											}

											dm := new(domain.DATA_MONITOR)
											dm.Action = INSERT_ACTION
											dm.BizDesc = "新增公司主要业务数据"
											dm.SourceTable = "TQ_SK_BUSIINFO"
											dm.TargetTable = "MAIN_COMPOSITION"
											r0json, _ := json.Marshal(e.Rows[0])
											dm.SourceDataJson = string(r0json)   //新增的值
											dm.ModifiedDataJson = string(r0json) //新增后的值
											dm.ActionTime = utils.GetNowTimeStr()
											if errI != nil {
												dm.ErrInfo = errI.Error()
											}
											rows = append(rows, dm)
										}

									}

								}

							}

						}
					}
				}

				if len(rows) > 0 {
					affDm, err3 := h.TDB.InsertDataMonitor(rows)
					if err3 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				//公司主要业务
				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal update.获取symbol失败:", zap.Any("err", err))
					return err
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						updatedMap["SYMBOL"] = symbol

						//取得分类口径
						typeStyle := fmt.Sprintf("%v", updatedMap["TYPESTYLE"])
						if typeStyle == TYPE_STYLE_PRODUCT { //分类口径：产品
							//报表日期
							publishDate := fmt.Sprintf("%v", updatedMap["PUBLISHDATE"])
							//转换为报告期
							reportYear := publishDate[0:4]
							/*
								//分类值
								className := fmt.Sprintf("%v", updatedMap["CLASSNAME"])
								//本期主营业务收入
								tCoreBizIncome := fmt.Sprintf("%v", updatedMap["TCOREBIZINCOME"])
								// 占主营业务收入比例
								coreBizIIncRto := fmt.Sprintf("%v", updatedMap["COREBIZINCRTO"])


								bci := new(domain.BUSI_CLASS_INFO)
								bci.CLASSNAME = className
								bci.TCOREBIZINCOME = tCoreBizIncome
								bci.COREBIZINCRTO = coreBizIIncRto

								productInfo, err1 := json.Marshal(bci)
								if err1 != nil {
									global.LOG.Error("goCanal TQ_SK_BUSIINFO.json.Marshal公司经营状况失败:", zap.Any("err", err1))
								}
							*/
							//重新查一遍公司经营状况信息
							busiInfos, err1 := h.CDB.GetTqSkBusiInfoByCompCodeAndReportYear(compCode, reportYear)
							if err1 != nil {
								global.LOG.Error("获取公司经营状态失败:", zap.String("compCode", compCode), zap.String("reportYear", reportYear), zap.Any("err", err1))
							}

							var bcis []*domain.BUSI_CLASS_INFO
							for _, b := range busiInfos {
								r := new(domain.BUSI_CLASS_INFO)

								r.CLASSNAME = b.Classname           //分类值
								r.TCOREBIZINCOME = b.Tcorebizincome //本期主营业务收入
								r.COREBIZINCRTO = b.Corebizincrto   //占主营业务收入比例

								bcis = append(bcis, r)

							}

							productInfo, jsonErr := json.Marshal(bcis)
							if jsonErr != nil {
								global.LOG.Error("goCanal TQ_FIN_PRGINCSTATEMENTNEW.json.Marshal公司经营状况失败:", zap.Any("err", jsonErr))
							}

							updatedMap["PRODUCTINFO"] = string(productInfo) //产品业务口径JSON字符串

							incstatementNews, err2 := h.CDB.GetTqFinPrgIncStatementNewByCompCodeAndReportYear(compCode, reportYear)
							if err2 != nil {
								global.LOG.Error("goCanal TQ_SK_BUSIINFO. 根据机构编码和报告期获取企业利润信息失败:", zap.String("compCode", compCode), zap.String("reportYear", reportYear), zap.Any("err", err2))
							}
							if incstatementNews != nil {

								maxRecord := incstatementNews[0]
								//取最新报告期类型的数据
								for _, r := range incstatementNews {
									if strings.Compare(maxRecord.Reportdatetype, r.Reportdatetype) == -1 {
										maxRecord = r
									}
								}

								if maxRecord != nil && len(maxRecord.Compcode) > 0 {
									updatedMap["BIZTOTCOST"] = maxRecord.Biztotcost //营业总成本
									updatedMap["PERPROFIT"] = maxRecord.Perprofit   //营业利润
									updatedMap["REPORTYEAR"] = maxRecord.Reportyear //会计年度

									affectedMc, err3 := h.TDB.UpdateMainComposition(UPDATE_MAIN_COMPOSITION_SQL, updatedMap)
									if err3 != nil {
										//仅记录出错日志，不退出程序，
										global.LOG.Error("goCanal.TQ_SK_BUSIINFO 更新公司主要业务出错:", zap.Any("err", err3))
									} else {
										global.LOG.Info("goCanal.TQ_SK_BUSIINFO  更新公司主要业务成功:", zap.Int64("nums", affectedMc))
									}

									dm := new(domain.DATA_MONITOR)
									dm.Action = UPDATE_ACTION
									dm.BizDesc = "更新公司主要业务数据"
									dm.SourceTable = "TQ_SK_BUSIINFO"
									dm.TargetTable = "MAIN_COMPOSITION"

									r1json, _ := json.Marshal(e.Rows[1])
									dm.ModifiedDataJson = string(r1json) //更改后的值

									r0json, _ := json.Marshal(e.Rows[0])
									dm.SourceDataJson = string(r0json) //更改前的值
									dm.ActionTime = utils.GetNowTimeStr()
									if err != nil {
										dm.ErrInfo = err.Error()
									}
									rows = append(rows, dm)

								}

							}

						}
					}
				}

				if len(rows) > 0 {
					affDm, err3 := h.TDB.InsertDataMonitor(rows)
					if err3 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				//公司主要业务
				compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal delete.获取symbol失败:", zap.Any("err", err))
					return err
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						deletedMap["SYMBOL"] = symbol

						// DELETE只能修改，可能只删除某一个ClassName，只修改公司经营状况信息
						//取得分类口径
						typeStyle := fmt.Sprintf("%v", deletedMap["TYPESTYLE"])
						if typeStyle == TYPE_STYLE_PRODUCT { //分类口径：产品
							//报表日期
							publishDate := fmt.Sprintf("%v", deletedMap["PUBLISHDATE"])
							//转换为报告期
							reportYear := publishDate[0:4]

							/*
								//重新查一遍公司经营状况信息
								busiInfos, err1 := h.CDB.GetTqSkBusiInfoByCompCodeAndReportYear(compCode, reportYear)
								if err1 != nil {
									global.LOG.Error("获取公司经营状态失败:", zap.String("compCode", compCode), zap.String("reportYear", reportYear), zap.Any("err", err1))
								}

								var bcis []*domain.BUSI_CLASS_INFO
								for _, b := range busiInfos {
									r := new(domain.BUSI_CLASS_INFO)

									r.CLASSNAME = b.Classname           //分类值
									r.TCOREBIZINCOME = b.Tcorebizincome //本期主营业务收入
									r.COREBIZINCRTO = b.Corebizincrto   //占主营业务收入比例

									bcis = append(bcis, r)

								}

								productInfo, jsonErr := json.Marshal(bcis)
								if jsonErr != nil {
									global.LOG.Error("goCanal TQ_FIN_PRGINCSTATEMENTNEW.json.Marshal公司经营状况失败:", zap.Any("err", jsonErr))
								}
							*/
							//deletedMap["PRODUCTINFO"] = string(productInfo) //产品业务口径JSON字符串

							deletedMap["PRODUCTINFO"] = "" //删除时直接变更为空

							incstatementNews, err2 := h.CDB.GetTqFinPrgIncStatementNewByCompCodeAndReportYear(compCode, reportYear)
							if err2 != nil {
								global.LOG.Error("goCanal TQ_SK_BUSIINFO. 根据机构编码和报告期获取企业利润信息失败:", zap.String("compCode", compCode), zap.String("reportYear", reportYear), zap.Any("err", err2))
							}
							if incstatementNews != nil {

								maxRecord := incstatementNews[0]
								//取最新报告期类型的数据
								for _, r := range incstatementNews {
									if strings.Compare(maxRecord.Reportdatetype, r.Reportdatetype) == -1 {
										maxRecord = r
									}
								}

								if maxRecord != nil && len(maxRecord.Compcode) > 0 {
									deletedMap["BIZTOTCOST"] = maxRecord.Biztotcost //营业总成本
									deletedMap["PERPROFIT"] = maxRecord.Perprofit   //营业利润
									deletedMap["REPORTYEAR"] = maxRecord.Reportyear //会计年度

									affectedMc, err3 := h.TDB.UpdateMainComposition(UPDATE_MAIN_COMPOSITION_SQL, deletedMap)
									if err3 != nil {
										//仅记录出错日志，不退出程序，
										global.LOG.Error("goCanal.TQ_SK_BUSIINFO 删除公司主要业务出错:", zap.Any("err", err3))
									} else {
										global.LOG.Info("goCanal.TQ_SK_BUSIINFO  删除公司主要业务成功:", zap.Int64("nums", affectedMc))
									}

									dm := new(domain.DATA_MONITOR)
									dm.Action = DELETE_ACTION
									dm.BizDesc = "删除公司主要业务数据"
									dm.SourceTable = "TQ_SK_BUSIINFO"
									dm.TargetTable = "MAIN_COMPOSITION"
									dm.ModifiedDataJson = "" //删除后的值为空

									r0json, _ := json.Marshal(e.Rows[0])
									dm.SourceDataJson = string(r0json) //删除前的值
									dm.ActionTime = utils.GetNowTimeStr()
									if err3 != nil {
										dm.ErrInfo = err3.Error()
									}
									rows = append(rows, dm)

								}

							}

						}

					}
				}

				if len(rows) > 0 {
					affDm, err4 := h.TDB.InsertDataMonitor(rows)
					if err4 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err4))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//机构资料表
		if e.Table.Name == "TQ_COMP_INFO" || e.Table.Name == "tq_comp_info" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				tqSKBasicInfos, err := h.CDB.GetTqSkBasicInfoByCompanyCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_INFO 根据机构编码获取股票基本信息出错:", zap.String("compCode", compCode), zap.Any("err", err))
					return err
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR
				if tqSKBasicInfos != nil {
					for _, tqSKBasicInfo := range tqSKBasicInfos {
						symbol := tqSKBasicInfo.Symbol     //证券代码
						listDate := tqSKBasicInfo.Listdate //上市日期
						exchange := tqSKBasicInfo.Exchange

						insertedMap["SYMBOL"] = symbol
						insertedMap["LISTDATE"] = listDate
						insertedMap["EXCHANGE"] = TransferExchane(exchange)

						region := fmt.Sprintf("%v", insertedMap["REGION"])
						if region == "<nil>" {
							region = ""
						}
						comptype1 := fmt.Sprintf("%v", insertedMap["COMPTYPE1"])
						if comptype1 == "<nil>" {
							comptype1 = ""
						}

						insertedMap["REGNAME"] = region     //所属区域
						insertedMap["COMPTYPE"] = comptype1 //当前行业

						affected, err1 := h.TDB.InsertCompanyProfileSingle(INSERT_COMPANY_PROFILE_SQL, insertedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal.TQ_COMP_INFO 新增公司基本情况出错:", zap.Any("err", err1))

						} else {
							global.LOG.Info("goCanal.TQ_COMP_INFO 新增公司基本情况成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = INSERT_ACTION
						dm.BizDesc = "新增公司基本信息"
						dm.SourceTable = "TQ_COMP_INFO"
						dm.TargetTable = "COMPANY_PROFILE"
						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json)   //新增的值
						dm.ModifiedDataJson = string(r0json) //新增后的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

					}
				}

				if len(rows) > 0 {
					affDm, err2 := h.TDB.InsertDataMonitor(rows)
					if err2 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				//公司主要业务
				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				tqSKBasicInfos, err := h.CDB.GetTqSkBasicInfoByCompanyCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_INFO 根据机构编码获取股票基本信息出错:", zap.String("compCode", compCode), zap.Any("err", err))
					return err
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR
				if tqSKBasicInfos != nil {
					for _, tqSKBasicInfo := range tqSKBasicInfos {
						symbol := tqSKBasicInfo.Symbol     //证券代码
						listDate := tqSKBasicInfo.Listdate //上市日期
						exchange := tqSKBasicInfo.Exchange

						updatedMap["EXCHANGE"] = TransferExchane(exchange)
						updatedMap["SYMBOL"] = symbol
						updatedMap["LISTDATE"] = listDate

						region := fmt.Sprintf("%v", updatedMap["REGION"])
						if region == "<nil>" {
							region = ""
						}
						comptype1 := fmt.Sprintf("%v", updatedMap["COMPTYPE1"])
						if comptype1 == "<nil>" {
							comptype1 = ""
						}

						updatedMap["REGNAME"] = region     //所属区域
						updatedMap["COMPTYPE"] = comptype1 //当前行业

						affected, err1 := h.TDB.UpdateCompanyProfile(UPDATE_COMPANY_PROFILE_SQL, updatedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal.TQ_COMP_INFO 更新公司基本情况出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal.TQ_COMP_INFO 更新公司基本情况成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = UPDATE_ACTION
						dm.BizDesc = "更新公司基本信息"
						dm.SourceTable = "TQ_COMP_INFO"
						dm.TargetTable = "COMPANY_PROFILE"

						r1json, _ := json.Marshal(e.Rows[1])
						dm.ModifiedDataJson = string(r1json) //更改后的值

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //更改前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

					}
				}

				if len(rows) > 0 {
					affDm, err2 := h.TDB.InsertDataMonitor(rows)
					if err2 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				//公司基本情况
				compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal delete.获取symbol失败:", zap.Any("err", err))
					return err
				}
				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						deletedMap["SYMBOL"] = symbol.Symbol
						deletedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						affected, err1 := h.TDB.DeleteCompanyProfile(DELETE_COMPANY_PROFILE_SQL, deletedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal.TQ_COMP_INFO 删除公司基本情况出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal.TQ_COMP_INFO 删除公司基本情况成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = DELETE_ACTION
						dm.BizDesc = "删除公司基本信息"
						dm.SourceTable = "TQ_COMP_INFO"
						dm.TargetTable = "COMPANY_PROFILE"
						dm.ModifiedDataJson = "" //删除后的值为空

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //删除前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err1 != nil {
							dm.ErrInfo = err1.Error()
						}
						rows = append(rows, dm)

					}
				}

				if len(rows) > 0 {
					affDm, err2 := h.TDB.InsertDataMonitor(rows)
					if err2 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err2))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//股票基本信息表
		if e.Table.Name == "TQ_SK_BASICINFO" || e.Table.Name == "tq_sk_basicinfo" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])

				exchange := fmt.Sprintf("%v", insertedMap["EXCHANGE"])
				insertedMap["EXCHANGE"] = TransferExchane(exchange)

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				//公司基本情况
				compInfos, err := h.CDB.GetCompInfoByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_INFO 根据机构编号获取公司基本情况出错:", zap.String("compCode", compCode), zap.Any("err", err))
					return err
				}
				if compInfos != nil {
					for _, c := range compInfos {
						regName := c.Region //所属区域
						insertedMap["REGNAME"] = regName
						compType := c.Comptype1 //当前行业
						insertedMap["COMPTYPE"] = compType
						compName := c.Compname //机构全称
						insertedMap["COMPNAME"] = compName
						regCapital := c.Regcapital //注册资本
						insertedMap["REGCAPITAL"] = regCapital
						legrep := c.Legrep //法人代表
						insertedMap["LEGREP"] = legrep
						regAddr := c.Regaddr //注册地址
						insertedMap["REGADDR"] = regAddr
						bizScope := c.Bizscope //经营范围
						insertedMap["BIZSCOPE"] = bizScope
						majobiz := c.Majorbiz //主要业务
						insertedMap["MAJORBIZ"] = majobiz
					}

					affected, err := h.TDB.InsertCompanyProfileSingle(INSERT_COMPANY_PROFILE_SQL, insertedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal.TQ_COMP_INFO 新增公司基本情况出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal.TQ_COMP_INFO 新增公司基本情况成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = INSERT_ACTION
					dm.BizDesc = "新增公司基本信息"
					dm.SourceTable = "TQ_SK_BASICINFO"
					dm.TargetTable = "COMPANY_PROFILE"
					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json)   //新增的值
					dm.ModifiedDataJson = string(r0json) //新增后的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)

				}

				if len(rows) > 0 {
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])

				exchange := fmt.Sprintf("%v", updatedMap["EXCHANGE"])
				updatedMap["EXCHANGE"] = TransferExchane(exchange)

				//公司基本情况
				compInfos, err := h.CDB.GetCompInfoByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_INFO 根据机构编号获取公司基本情况出错:", zap.String("compCode", compCode), zap.Any("err", err))
					return err
				}
				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				if compInfos != nil {
					for _, c := range compInfos {
						regName := c.Region //所属区域
						updatedMap["REGNAME"] = regName
						compType := c.Comptype1 //当前行业
						updatedMap["COMPTYPE"] = compType
						compName := c.Compname //机构全称
						updatedMap["COMPNAME"] = compName
						regCapital := c.Regcapital //注册资本
						updatedMap["REGCAPITAL"] = regCapital
						legrep := c.Legrep //法人代表
						updatedMap["LEGREP"] = legrep
						regAddr := c.Regaddr //注册地址
						updatedMap["REGADDR"] = regAddr
						bizScope := c.Bizscope //经营范围
						updatedMap["BIZSCOPE"] = bizScope
						majobiz := c.Majorbiz //主要业务
						updatedMap["MAJORBIZ"] = majobiz
					}

					affected, err := h.TDB.UpdateCompanyProfile(UPDATE_COMPANY_PROFILE_SQL, updatedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal.TQ_COMP_INFO 更新公司基本情况出错:", zap.Any("err", err))
					} else {
						global.LOG.Info("goCanal.TQ_COMP_INFO 更新公司基本情况成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = UPDATE_ACTION
					dm.BizDesc = "更新公司基本信息"
					dm.SourceTable = "TQ_SK_BASICINFO"
					dm.TargetTable = "COMPANY_PROFILE"

					r1json, _ := json.Marshal(e.Rows[1])
					dm.ModifiedDataJson = string(r1json) //更改后的值

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //更改前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)
				}

				if len(rows) > 0 {
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", deletedMap["COMPCODE"])

				exchange := fmt.Sprintf("%v", deletedMap["EXCHANGE"])
				deletedMap["EXCHANGE"] = TransferExchane(exchange)

				//公司基本情况
				compInfos, err := h.CDB.GetCompInfoByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_INFO 根据机构编号获取公司基本情况出错:", zap.String("compCode", compCode), zap.Any("err", err))
					return err
				}
				//记录操作日志
				var rows []*domain.DATA_MONITOR

				if compInfos != nil {
					for _, c := range compInfos {
						regName := c.Region //所属区域
						deletedMap["REGNAME"] = regName
						compType := c.Comptype1 //当前行业
						deletedMap["COMPTYPE"] = compType
						compName := c.Compname //机构全称
						deletedMap["COMPNAME"] = compName
						regCapital := c.Regcapital //注册资本
						deletedMap["REGCAPITAL"] = regCapital
						legrep := c.Legrep //法人代表
						deletedMap["LEGREP"] = legrep
						regAddr := c.Regaddr //注册地址
						deletedMap["REGADDR"] = regAddr
						bizScope := c.Bizscope //经营范围
						deletedMap["BIZSCOPE"] = bizScope
						majobiz := c.Majorbiz //主要业务
						deletedMap["MAJORBIZ"] = majobiz
					}

					affected, err := h.TDB.DeleteCompanyProfile(DELETE_COMPANY_PROFILE_SQL, deletedMap)
					if err != nil {
						//仅记录出错日志，不退出程序，
						global.LOG.Error("goCanal.TQ_COMP_INFO 删除公司基本情况出错:", zap.Any("err", err))

					} else {
						global.LOG.Info("goCanal.TQ_COMP_INFO 删除公司基本情况成功:", zap.Int64("nums", affected))
					}

					dm := new(domain.DATA_MONITOR)
					dm.Action = DELETE_ACTION
					dm.BizDesc = "删除公司基本信息"
					dm.SourceTable = "TQ_SK_BASICINFO"
					dm.TargetTable = "COMPANY_PROFILE"
					dm.ModifiedDataJson = "" //删除后的值为空

					r0json, _ := json.Marshal(e.Rows[0])
					dm.SourceDataJson = string(r0json) //删除前的值
					dm.ActionTime = utils.GetNowTimeStr()
					if err != nil {
						dm.ErrInfo = err.Error()
					}
					rows = append(rows, dm)
				}

				if len(rows) > 0 {
					affDm, err := h.TDB.InsertDataMonitor(rows)
					if err != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
		}
		//股东变化情况
		if e.Table.Name == "TQ_SK_SHAREHOLDERNUM" || e.Table.Name == "tq_sk_shareholdernum" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				tqSKBasicInfos, err := h.CDB.GetTqSkBasicInfoByCompanyCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_INFO 根据机构编码，获取股票基本信息出错", zap.String("compCode", compCode), zap.Any("err", err))
					return err
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				if tqSKBasicInfos != nil {
					for _, tqSKBasicInfo := range tqSKBasicInfos {
						symbol := tqSKBasicInfo.Symbol //证券代码
						seCode := tqSKBasicInfo.Secode //证券内码
						exchange := tqSKBasicInfo.Exchange

						insertedMap["EXCHANGE"] = TransferExchane(exchange)
						insertedMap["SYMBOL"] = symbol

						totalShamt := fmt.Sprintf("%v", insertedMap["TOTALSHAMT"]) //股东总户数
						if totalShamt == "<nil>" {
							totalShamt = "0"
						}

						totalShRto := fmt.Sprintf("%v", insertedMap["TOTALSHRTO"]) //股东总户数较上期增减
						if totalShRto == "<nil>" {
							totalShRto = "0"
						}

						if totalShamt != "0" && totalShamt != "0.0" && totalShamt != "null" && totalShamt != "" {
							// 较上期变化： TOTALSHRTO/TOTALSHAMT
							totalShRtoDec, _ := decimal.NewFromString(totalShRto)
							totalShAmtDec, _ := decimal.NewFromString(totalShamt)
							chgrtoDec := totalShRtoDec.Div(totalShAmtDec)
							totalShchgrto := chgrtoDec.String()

							insertedMap["TOTALSHCHGRTO"] = totalShchgrto //较上期变化

						}

						endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"]) //截止日期
						kavgsh := fmt.Sprintf("%v", insertedMap["KAVGSH"])   // 户均持股数
						if kavgsh == "<nil>" {
							kavgsh = "0"
						}

						skdailyPrices, err1 := h.CDB.GetSkDailyPrices4DataChange(seCode, endDate)
						if err1 != nil {
							global.LOG.Error("goCanal.TQ_COMP_INFO 根据证券内码，获取股票历史日交易信息出错", zap.String("seCode", seCode), zap.Any("err", err))

						}

						if skdailyPrices != nil && len(skdailyPrices) > 0 {
							sdp := skdailyPrices[0]

							tclose := sdp.Tclose

							//人均持股金额(元):公式：TCLOSE收盘价*KAVGSH户均持股数
							tcloseDec, _ := decimal.NewFromString(tclose)
							kavgshDec, _ := decimal.NewFromString(kavgsh)
							kavgholdamtDec := tcloseDec.Mul(kavgshDec)

							insertedMap["KAVGHOLDAMT"] = kavgholdamtDec //人均持股金额(元)
							insertedMap["TCLOSE"] = tclose              //收盘价
						} else {
							insertedMap["KAVGHOLDAMT"] = "0.000" //人均持股金额(元)
							insertedMap["TCLOSE"] = "0.0000"     //收盘价
						}

						affected, err2 := h.TDB.InsertHolderChangeSingle(INSERT_HOLDER_CHANGE_SQL, insertedMap)
						if err2 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("ggoCanal.TQ_SK_SHAREHOLDERNUM 新增股东变化情况出错:", zap.Any("err", err2))
						} else {
							global.LOG.Info("goCanal.TQ_SK_SHAREHOLDERNUM 新增股东变化情况成功:", zap.Int64("nums", affected))
						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = INSERT_ACTION
						dm.BizDesc = "新增股东变动情况"
						dm.SourceTable = "TQ_SK_SHAREHOLDERNUM"
						dm.TargetTable = "HOLDER_CHANGE"
						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json)   //新增的值
						dm.ModifiedDataJson = string(r0json) //新增后的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err2 != nil {
							dm.ErrInfo = err2.Error()
						}
						rows = append(rows, dm)

					}
				}

				if len(rows) > 0 {
					affDm, err1 := h.TDB.InsertDataMonitor(rows)
					if err1 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err1))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				//公司主要业务
				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				tqSKBasicInfos, err := h.CDB.GetTqSkBasicInfoByCompanyCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal.TQ_COMP_INFO 根据机构编码，获取股票基本信息出错", zap.String("compCode", compCode), zap.Any("err", err))
					return err
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				if tqSKBasicInfos != nil {
					for _, tqSKBasicInfo := range tqSKBasicInfos {
						symbol := tqSKBasicInfo.Symbol //证券代码
						seCode := tqSKBasicInfo.Secode //证券内码

						updatedMap["SYMBOL"] = symbol

						totalShamt := fmt.Sprintf("%v", updatedMap["TOTALSHAMT"]) //股东总户数
						if totalShamt == "<nil>" {
							totalShamt = "0"
						}
						totalShRto := fmt.Sprintf("%v", updatedMap["TOTALSHRTO"]) //股东总户数较上期增减
						if totalShRto == "<nil>" {
							totalShRto = "0"
						}

						if totalShamt != "0" && totalShamt != "0.0" && totalShamt != "null" && totalShamt != "" {
							// 较上期变化： TOTALSHRTO/TOTALSHAMT
							totalShRtoDec, _ := decimal.NewFromString(totalShRto)
							totalShAmtDec, _ := decimal.NewFromString(totalShamt)
							chgrtoDec := totalShRtoDec.Div(totalShAmtDec)
							totalShchgrto := chgrtoDec.String()

							updatedMap["TOTALSHCHGRTO"] = totalShchgrto //较上期变化
						}

						endDate := fmt.Sprintf("%v", updatedMap["ENDDATE"]) //截止日期
						kavgsh := fmt.Sprintf("%v", updatedMap["KAVGSH"])   // 户均持股数
						if kavgsh == "<nil>" {
							kavgsh = "0"
						}

						skdailyPrices, err1 := h.CDB.GetSkDailyPrices4DataChange(seCode, endDate)
						if err1 != nil {
							global.LOG.Error("goCanal.TQ_COMP_INFO 根据证券内码，获取股票历史日交易信息出错", zap.String("seCode", seCode), zap.Any("err", err))

						}

						if skdailyPrices != nil && len(skdailyPrices) > 0 {
							sdp := skdailyPrices[0]

							tclose := sdp.Tclose

							//人均持股金额(元):公式：TCLOSE收盘价*KAVGSH户均持股数
							tcloseDec, _ := decimal.NewFromString(tclose)
							kavgshDec, _ := decimal.NewFromString(kavgsh)
							kavgholdamtDec := tcloseDec.Mul(kavgshDec)

							updatedMap["KAVGHOLDAMT"] = kavgholdamtDec //人均持股金额(元)
							updatedMap["TCLOSE"] = tclose              //收盘价
						} else {
							updatedMap["KAVGHOLDAMT"] = "0.000" //人均持股金额(元)
							updatedMap["TCLOSE"] = "0.0000"     //收盘价
						}

						affected, err2 := h.TDB.UpdateHolderChange(UPDATE_HOLDER_CHANGE_SQL, updatedMap)
						if err2 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("ggoCanal.TQ_SK_SHAREHOLDERNUM 更新股东变化情况出错:", zap.Any("err", err2))

						} else {
							global.LOG.Info("goCanal.TQ_SK_SHAREHOLDERNUM 更新股东变化情况成功:", zap.Int64("nums", affected))

						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = UPDATE_ACTION
						dm.BizDesc = "更新股东变动情况"
						dm.SourceTable = "TQ_SK_SHAREHOLDERNUM"
						dm.TargetTable = "HOLDER_CHANGE"

						r1json, _ := json.Marshal(e.Rows[1])
						dm.ModifiedDataJson = string(r1json) //更改后的值

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //更改前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err2 != nil {
							dm.ErrInfo = err2.Error()
						}
						rows = append(rows, dm)

					}
				}

				if len(rows) > 0 {
					affDm, err3 := h.TDB.InsertDataMonitor(rows)
					if err3 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err3))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				affected, err2 := h.TDB.DeleteHolderChange(DELETE_HOLDER_CHANGE_SQL, deletedMap)
				if err2 != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("ggoCanal.TQ_SK_SHAREHOLDERNUM 删除股东变化情况出错:", zap.Any("err", err2))

				} else {
					global.LOG.Info("goCanal.TQ_SK_SHAREHOLDERNUM 删除股东变化情况成功:", zap.Int64("nums", affected))

				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除股东变动情况"
				dm.SourceTable = "TQ_SK_SHAREHOLDERNUM"
				dm.TargetTable = "HOLDER_CHANGE"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err2 != nil {
					dm.ErrInfo = err2.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		//十大股东
		if e.Table.Name == "TQ_SK_SHAREHOLDER" || e.Table.Name == "tq_sk_shareholder" {
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val
					//	news.ID = val.(int64)
					//if e.Table.Columns[i].Name == "ID" {
					//}
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				compCode := fmt.Sprintf("%v", insertedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal insert.获取symbol失败:", zap.Any("err", err))
					return err
				}

				endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
				if endDate != "" && endDate != "<nil>" {
					insertedMap["PUBLISHDATE"] = endDate
				}

				if symbols != nil {
					for _, symbol := range symbols {
						//设置symbol
						insertedMap["SYMBOL"] = symbol.Symbol
						insertedMap["EXCHANGE"] = TransferExchane(symbol.Exchange)

						//本期变动数量
						curchg := fmt.Sprintf("%v", insertedMap["CURCHG"])
						if curchg == "<nil>" {
							curchg = "0"
						}

						//HOLDERAMT 持股数
						holderamt := fmt.Sprintf("%v", insertedMap["HOLDERAMT"])
						if holderamt == "<nil>" {
							holderamt = "0"
						}
						curChgDec, _ := decimal.NewFromString(curchg)
						holderAmtDec, _ := decimal.NewFromString(holderamt)
						sumDec := holderAmtDec.Add(curChgDec)
						if sumDec.String() != "0" && sumDec.String() != "0.00" && sumDec.String() != "null" && sumDec.String() != "" {
							curChgRageDec := curChgDec.Div(sumDec) //本期变动数量增减幅度:	CURCHG本期变动数量/( HOLDERAMT持股数量 + CURCHG本期变动数量)*100%
							currChgRate := curChgRageDec.String()
							//本期变动数量增减幅度
							insertedMap["CURCHGRATE"] = currChgRate
						}

						//PUBLISHDATE 信息发布日期
						//publishDate := fmt.Sprintf("%v", insertedMap["PUBLISHDATE"])
						circAmt := fmt.Sprintf("%v", insertedMap["CIRCAMT"])
						if circAmt == "<nil>" {
							circAmt = "0"
						}
						//shc, err := h.CDB.GetShareStruChgByCompCodeAndPublishDate(compCode, publishDate)
						//if err != nil {
						//	log.Printf("goCanal insert.TQ_SK_SHAREHOLDER 根据公司内码：%v,信息发布日期：%v 获取股本结构变化失败:%v", compCode, publishDate, err)
						//}
						//if shc != nil {
						//CIRCSKAMT
						//流通股
						//circSKAmt := shc.Circskamt
						if circAmt != "0" && circAmt != "0.00" && circAmt != "null" && circAmt != "" {
							circAmtDec, _ := decimal.NewFromString(circAmt)
							//占流通股比：HOLDERAMT/CIRCSKAMT
							rtoDec := holderAmtDec.Div(circAmtDec)
							insertedMap["HOLDCIRCSKAMTRTO"] = rtoDec
						} else {
							insertedMap["HOLDCIRCSKAMTRTO"] = "0.0000"
						}

						//}

						affected, err1 := h.TDB.InsertTenHolderSingle(INSERT_TEN_HOLDER_SQL, insertedMap)
						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 新增十大股东出错:", zap.Any("err", err1))
						} else {
							global.LOG.Info("goCanal 新增十大股东成功:", zap.Int64("nums", affected))

						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = INSERT_ACTION
						dm.BizDesc = "新增十大股东"
						dm.SourceTable = "TQ_SK_SHAREHOLDER"
						dm.TargetTable = "TEN_HOLDER"
						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json)   //新增的值
						dm.ModifiedDataJson = string(r0json) //新增后的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err != nil {
							dm.ErrInfo = err.Error()
						}
						rows = append(rows, dm)

					}
				}

				if len(rows) > 0 {
					affDm, err1 := h.TDB.InsertDataMonitor(rows)
					if err1 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err1))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {

					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				compCode := fmt.Sprintf("%v", updatedMap["COMPCODE"])
				symbols, err := h.CDB.GetSymbolByCompCode(compCode)
				if err != nil {
					global.LOG.Error("goCanal update.获取symbol失败:", zap.Any("err", err))
					return err
				}

				endDate := fmt.Sprintf("%v", updatedMap["ENDDATE"])
				if endDate != "" && endDate != "<nil>" {
					updatedMap["PUBLISHDATE"] = endDate
				}

				if symbols != nil {
					for _, symbol := range symbols {

						//设置symbol
						updatedMap["SYMBOL"] = symbol

						//本期变动数量
						curchg := fmt.Sprintf("%v", updatedMap["CURCHG"])
						if curchg == "<nil>" {
							curchg = "0"
						}
						//HOLDERAMT 持股数
						holderamt := fmt.Sprintf("%v", updatedMap["HOLDERAMT"])
						if holderamt == "<nil>" {
							holderamt = "0"
						}

						curChgDec, _ := decimal.NewFromString(curchg)
						holderAmtDec, _ := decimal.NewFromString(holderamt)
						sumDec := holderAmtDec.Add(curChgDec)

						if sumDec.String() != "0" && sumDec.String() != "0.00" && sumDec.String() != "null" && sumDec.String() != "" {
							curChgRageDec := curChgDec.Div(sumDec) //本期变动数量增减幅度:	CURCHG本期变动数量/( HOLDERAMT持股数量 + CURCHG本期变动数量)*100%
							currChgRate := curChgRageDec.String()
							//本期变动数量增减幅度
							updatedMap["CURCHGRATE"] = currChgRate
						}

						//PUBLISHDATE 信息发布日期
						//publishDate := fmt.Sprintf("%v", insertedMap["PUBLISHDATE"])
						circAmt := fmt.Sprintf("%v", updatedMap["CIRCAMT"])
						if circAmt == "<nil>" {
							circAmt = "0"
						}
						//shc, err := h.CDB.GetShareStruChgByCompCodeAndPublishDate(compCode, publishDate)
						//if err != nil {
						//	log.Printf("goCanal insert.TQ_SK_SHAREHOLDER 根据公司内码：%v,信息发布日期：%v 获取股本结构变化失败:%v", compCode, publishDate, err)
						//}
						//if shc != nil {
						//CIRCSKAMT
						//流通股
						//circSKAmt := shc.Circskamt
						if circAmt != "0" && circAmt != "0.00" && circAmt != "null" && circAmt != "" {
							circAmtDec, _ := decimal.NewFromString(circAmt)
							//占流通股比：HOLDERAMT/CIRCSKAMT
							rtoDec := holderAmtDec.Div(circAmtDec)
							updatedMap["HOLDCIRCSKAMTRTO"] = rtoDec
						}

						//}

						affected, err1 := h.TDB.UpdateTenHolder(UPDATE_TEN_HOLDER_SQL, updatedMap)

						if err1 != nil {
							//仅记录出错日志，不退出程序，
							global.LOG.Error("goCanal 更新十大股东出错:", zap.Any("err", err1))

						} else {
							global.LOG.Info("goCanal 更新十大股东成功:", zap.Int64("nums", affected))

						}

						dm := new(domain.DATA_MONITOR)
						dm.Action = UPDATE_ACTION
						dm.BizDesc = "更新十大股东"
						dm.SourceTable = "TQ_SK_SHAREHOLDER"
						dm.TargetTable = "TEN_HOLDER"

						r1json, _ := json.Marshal(e.Rows[1])
						dm.ModifiedDataJson = string(r1json) //更改后的值

						r0json, _ := json.Marshal(e.Rows[0])
						dm.SourceDataJson = string(r0json) //更改前的值
						dm.ActionTime = utils.GetNowTimeStr()
						if err != nil {
							dm.ErrInfo = err.Error()
						}
						rows = append(rows, dm)

					}
				}

				if len(rows) > 0 {
					affDm, err1 := h.TDB.InsertDataMonitor(rows)
					if err1 != nil {
						global.LOG.Error("插入日志记录出错:", zap.Any("err", err1))
					}
					global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))
				}

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				affected, err := h.TDB.DeleteTenHolder(DELETE_TEN_HOLDER_SQL, deletedMap)
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除十大股东出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 删除十大股东成功:", zap.Int64("nums", affected))
				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除十大股东"
				dm.SourceTable = "TQ_SK_SHAREHOLDER"
				dm.TargetTable = "TEN_HOLDER"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
		}
		// 股票基本面简表--最新指标
		if e.Table.Name == "TQ_SK_FUNDAMENTALS" || e.Table.Name == "tq_sk_fundamentals" {
			if e.Action == canal.UpdateAction {
				updatedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal update.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))

					updatedMap[e.Table.Columns[i].Name] = val
				}

				seCode := fmt.Sprintf("%v", updatedMap["SECODE"]) //SH603165
				symbol := seCode[2:]                              //构建证券代码
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				if err != nil {
					global.LOG.Error("goCanal update.根据symbol，获取compCode失败:", zap.String("symbol", symbol), zap.Any("err", err))
					return err
				}
				//设置symbol
				updatedMap["COMPCODE"] = compCode

				um := make(map[string]string)
				um["SYMBOL"] = symbol
				um["COMPCODE"] = compCode
				endDate := fmt.Sprintf("%v", updatedMap["ENDDATE"])
				um["ENDDATE"] = endDate
				basiceps := fmt.Sprintf("%v", updatedMap["BASICEPS"])
				if basiceps == "<nil>" {
					basiceps = "0.0000"
				}
				um["BASICEPS"] = basiceps
				naps := fmt.Sprintf("%v", updatedMap["NAPS"])
				if naps == "<nil>" {
					naps = "0.0000"
				}
				um["NAPS"] = naps
				totalshare := fmt.Sprintf("%v", updatedMap["TOTALSHARE"])
				if totalshare == "<nil>" {
					totalshare = "0.0000"
				}
				um["TOTALSHARE"] = totalshare
				roe := fmt.Sprintf("%v", updatedMap["ROE"])
				if roe == "<nil>" {
					roe = "0.00"
				}
				um["ROE"] = roe
				opercfps := fmt.Sprintf("%v", updatedMap["OPERCFPS"])
				if opercfps == "<nil>" {
					opercfps = "0.0000"
				}
				um["OPERCFPS"] = opercfps
				npgrt := fmt.Sprintf("%v", updatedMap["NPGRT"])
				if npgrt == "<nil>" {
					npgrt = "0.00"
				}
				um["NPGRT"] = npgrt

				affected, err := h.TDB.UpdateLatestIndicator(um) // 更新主要指标
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 更新最新指标表出错:", zap.Any("err", err))
				} else {
					global.LOG.Info("goCanal 更新最新指标表成功:", zap.Int64("nums", affected))

				}

				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "更新最新指标数据"
				dm.SourceTable = "TQ_SK_FUNDAMENTALS"
				dm.TargetTable = "LATEST_INDICATOR"

				r1json, _ := json.Marshal(e.Rows[1])
				dm.ModifiedDataJson = string(r1json) //更改后的值

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //更改前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.InsertAction {
				insertedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					insertedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal insert.table.column.val:", zap.String("Value", colVal))
				}
				seCode := fmt.Sprintf("%v", insertedMap["SECODE"]) //SH603165
				symbol := seCode[2:]                               //构建证券代码
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)
				if err != nil {
					global.LOG.Error("goCanal insert.根据symbol，获取compCode失败:", zap.String("symbol", symbol), zap.Any("err", err))
				}
				// 记录操作日志
				var rows []*domain.DATA_MONITOR

				im := make(map[string]string)

				basicInfo, err := h.CDB.GetTqSkBasicInfoBySymbol(symbol)
				if err != nil {
					global.LOG.Error("goCanal insert.根据symbol，获取股票基本信息失败:", zap.String("symbol", symbol), zap.Any("err", err))

				}

				if basicInfo != nil {
					exchange := basicInfo.Exchange
					im["EXCHANGE"] = TransferExchane(exchange)
				}

				im["SYMBOL"] = symbol
				im["COMPCODE"] = compCode

				endDate := fmt.Sprintf("%v", insertedMap["ENDDATE"])
				if endDate == "<nil>" {
					endDate = ""
				}
				im["ENDDATE"] = endDate
				basiceps := fmt.Sprintf("%v", insertedMap["BASICEPS"])
				if basiceps == "<nil>" {
					basiceps = "0.0000"
				}
				im["BASICEPS"] = basiceps
				naps := fmt.Sprintf("%v", insertedMap["NAPS"])
				if naps == "<nil>" {
					naps = "0.0000"
				}
				im["NAPS"] = naps
				totalshare := fmt.Sprintf("%v", insertedMap["TOTALSHARE"])
				if totalshare == "<nil>" {
					totalshare = "0.0000"
				}
				im["TOTALSHARE"] = totalshare
				roe := fmt.Sprintf("%v", insertedMap["ROE"])
				if roe == "<nil>" {
					roe = "0.00"
				}
				im["ROE"] = roe
				opercfps := fmt.Sprintf("%v", insertedMap["OPERCFPS"])
				if opercfps == "<nil>" {
					opercfps = "0.0000"
				}
				im["OPERCFPS"] = opercfps
				npgrt := fmt.Sprintf("%v", insertedMap["NPGRT"])
				if npgrt == "<nil>" {
					npgrt = "0.00"
				}
				im["NPGRT"] = npgrt

				//查询TQ_FIN_PRGFINMAININDEX 主要财务指标(产品表）信息
				prgFinMaindexs, err1 := h.CDB.GetPrgFinMainIndexByCompCodeAndEndDate(compCode, endDate)
				if err1 != nil {
					global.LOG.Error("goCanal 新增最新指标表,获取Q_FIN_PRGFINMAININDEX 主要财务指标(产品表）信息出错:", zap.Any("err", err1))
				}
				if prgFinMaindexs != nil && len(prgFinMaindexs) > 0 {
					p := prgFinMaindexs[0]
					reportYear := p.Reportyear
					reportDateType := p.Reportdatetype
					epsbasicepscut := p.Epsbasicepscut
					if epsbasicepscut == "" {
						epsbasicepscut = "0.000000"
					}
					im["REPORTYEAR"] = reportYear
					im["REPORTDATETYPE"] = reportDateType
					im["EPSBASICEPSCUT"] = epsbasicepscut
				}

				//查询TQ_FIN_PRGINCSTATEMENTNEW,一般企业利润表(新准则产品表)信息
				prgIncStsNews, err2 := h.CDB.GetPrgIncStatementNewByCompCodeAndEndDate(compCode, endDate)
				if err2 != nil {
					global.LOG.Error("goCanal 新增最新指标表,查询TQ_FIN_PRGINCSTATEMENTNEW 一般企业利润表(新准则产品表)信息出错:", zap.Any("err", err2))
				}

				if prgIncStsNews != nil && len(prgIncStsNews) > 0 {
					s := prgIncStsNews[0]
					bizInco := s.Bizinco
					if bizInco == "" {
						bizInco = "0.000000"
					}
					netProfit := s.Netprofit
					if netProfit == "" {
						netProfit = "0.000000"
					}
					im["BIZINCO"] = bizInco
					im["NETPROFIT"] = netProfit
				}

				//查询TQ_FIN_PRGINDICDATA 衍生财务指标(产品表)_V3表信息
				indicDatas, err3 := h.CDB.GetPrgIndicDataByCompCodeAndEndDate(compCode, endDate)
				if err3 != nil {
					global.LOG.Error("goCanal 新增最新指标表,查询TQ_FIN_PRGINDICDATA 衍生财务指标(产品表)_V3表 信息出错:", zap.Any("err", err3))
				}
				if indicDatas != nil && len(indicDatas) > 0 {
					i := indicDatas[0]

					sgpmargin := i.Sgpmargin
					if sgpmargin == "" {
						sgpmargin = "0.000000"
					}
					npcut := i.Npcut
					if npcut == "" {
						npcut = "0.000000"
					}
					im["SGPMARGIN"] = sgpmargin
					im["NPCUT"] = npcut

				}

				//查询 TQ_FIN_PRGINDICDATASUB 衍生财务指标副表(产品表)_V3表信息
				indicDataSubs, err4 := h.CDB.GetPrgIndicDataSubByCompCodeAndEndDate(compCode, endDate)
				if err4 != nil {
					global.LOG.Error("goCanal 新增最新指标表,查询TQ_FIN_PRGINDICDATASUB 衍生财务指标副表(产品表)_V3表信息 信息出错:", zap.Any("err", err4))
				}

				if indicDataSubs != nil && len(indicDataSubs) > 0 {
					sub := indicDataSubs[0]
					operinyoyb := sub.Operinyoyb
					if operinyoyb == "" {
						operinyoyb = "0.000000"
					}
					netinpnrplyoyb := sub.Netinpnrplyoyb
					if netinpnrplyoyb == "" {
						netinpnrplyoyb = "0.000000"
					}
					im["OPERINYOYB"] = operinyoyb
					im["NETINPNRPLYOYB"] = netinpnrplyoyb
				}

				affected, err := h.TDB.InsertLatestIndicatorSingle(INSERT_LATEST_INDICATOR_SQL, im) // 新增主要指标
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 新增最新指标表出错:", zap.Any("err", err))

				} else {
					global.LOG.Info("goCanal 新增最新指标表成功:", zap.Int64("nums", affected))

				}

				dm := new(domain.DATA_MONITOR)
				dm.Action = INSERT_ACTION
				dm.BizDesc = "新增最新指标数据"
				dm.SourceTable = "TQ_SK_FUNDAMENTALS"
				dm.TargetTable = "LATEST_INDICATOR"
				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json)   //新增的值
				dm.ModifiedDataJson = string(r0json) //新增后的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}
			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					//colVal := fmt.Sprintf("%v", val)
					//global.LOG.Info(">>>>>>>>>>goCanal delete.table.column.val:", zap.String("Value", colVal))
				}

				seCode := fmt.Sprintf("%v", deletedMap["SECODE"]) //SH603165
				symbol := seCode[2:]                              //构建证券代码
				compCode, err := h.CDB.GetCompCodeBySymbol(symbol)

				if err != nil {
					global.LOG.Error("goCanal delete.根据symbol，获取compCode失败:", zap.String("symbol", symbol), zap.Any("err", err))
				}

				zeroVal := "0.000000"
				updateMap := make(map[string]string)
				updateMap["COMPCODE"] = compCode
				updateMap["SYMBOL"] = symbol
				updateMap["BASICEPS"] = zeroVal
				updateMap["NAPS"] = zeroVal
				updateMap["OPERCFPS"] = zeroVal
				updateMap["ROE"] = zeroVal
				updateMap["NPGRT"] = zeroVal
				updateMap["TOTALSHARE"] = zeroVal

				affected, err := h.TDB.UpdateLatestIndicator(updateMap) // 更新主要指标
				if err != nil {
					//仅记录出错日志，不退出程序，
					global.LOG.Error("goCanal 删除最新指标表出错:", zap.Any("err", err))

				} else {
					global.LOG.Info("goCanal 删除最新指标表成功:", zap.Int64("nums", affected))

				}

				//记录操作日志
				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = DELETE_ACTION
				dm.BizDesc = "删除最新指标数据"
				dm.SourceTable = "TQ_SK_FUNDAMENTALS"
				dm.TargetTable = "LATEST_INDICATOR"
				dm.ModifiedDataJson = "" //删除后的值为空

				r0json, _ := json.Marshal(e.Rows[0])
				dm.SourceDataJson = string(r0json) //删除前的值
				dm.ActionTime = utils.GetNowTimeStr()
				if err != nil {
					dm.ErrInfo = err.Error()
				}
				rows = append(rows, dm)

				affDm, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				global.LOG.Info("成功插入日志记录数据条数:", zap.Int64("nums", affDm))

			}

		}
		if e.Table.Name == "TEST" || e.Table.Name == "test" {
			if e.Action == canal.UpdateAction {
				global.LOG.Info(">>>>>>>>>>goCanal insert.table.Table.name:", zap.String("Name", e.Table.Name))
				for i, val := range e.Rows[1] {
					global.LOG.Info(">>>>>>>>>>goCanal update.table.column.name:", zap.String("Name", e.Table.Columns[i].Name))
					colVal := fmt.Sprintf("%v", val)
					global.LOG.Info(">>>>>>>>>>goCanal update.table.column.val:", zap.String("Value", colVal))
				}

				var rows []*domain.DATA_MONITOR

				dm := new(domain.DATA_MONITOR)
				dm.Action = UPDATE_ACTION
				dm.BizDesc = "测试Test表的插入"
				dm.SourceTable = "TEST"
				dm.TargetTable = "TEST_TARGET"

				r1json, _ := json.Marshal(e.Rows[1])
				global.LOG.Info("修改后记录:", zap.String("nums", string(r1json)))

				dm.ModifiedDataJson = string(r1json)

				fmt.Println("-------------------------------------------")

				for i, val := range e.Rows[0] {
					global.LOG.Info("goCanal 更改前字段名:", zap.String("name", e.Table.Columns[i].Name))
					colVal := fmt.Sprintf("%v", val)
					global.LOG.Info("goCanal 更改前字段值l:", zap.String("Value", colVal))
				}

				r0json, _ := json.Marshal(e.Rows[0])
				global.LOG.Info("修改前记录:", zap.String("nums", string(r0json)))
				dm.SourceDataJson = string(r0json)
				dm.ActionTime = utils.GetNowTimeStr()
				rows = append(rows, dm)

				affected, err := h.TDB.InsertDataMonitor(rows)
				if err != nil {
					global.LOG.Error("插入日志记录出错:", zap.Any("err", err))
				}
				log.Printf("插入日志记录数据条数：%v", affected)

			}

			if e.Action == canal.DeleteAction {
				deletedMap := make(map[string]interface{})
				global.LOG.Info(">>>>>>>>>>goCanal delete.table.Table.name:", zap.String("tableName", e.Table.Name))
				for i, val := range e.Rows[0] {
					deletedMap[e.Table.Columns[i].Name] = val

					global.LOG.Info("goCanal 更改前字段名:", zap.String("name", e.Table.Columns[i].Name))
					colVal := fmt.Sprintf("%v", val)
					global.LOG.Info("goCanal 更改前字段值l:", zap.String("Value", colVal))
				}
			}
		}
		return nil

	}
	return nil
}
